0

So I'm having trouble calling a template member function of a template class. When I try to do it I get the following error:

test.cpp:19:5: error: invalid operands of types ‘<unresolved
overloaded function type>’ and ‘unsigned int’ to binary ‘operator<’

and clang++ says:

test.cpp:19:5: error: reference to non-static member function must be called
    arrIn->partition<NPart>(NULL, NULL);
    ^~~~~~~~~~~~~~~~

Any ideas how to fix this?

Thanks!

#define NULL 0

template <class V, unsigned int N>
struct SubArray {
public:
  template <unsigned int NDIM>
  void partition(const int dimsToPart[], const unsigned int numParts[]) {
    // bla...
  }

};

template <unsigned int N>
struct CartTopology {
public:
  template <class V, unsigned int NArr, unsigned int NPart>
  void scatterArrayBlocked(SubArray<V, NArr> *arrIn, SubArray<V, NArr> *arrOut,
    const int dimsBefore[], const int dimsAfter[]) {
    arrIn->partition<NPart>(NULL, NULL);
  }

};

int main(int argc, char** argv) {
  SubArray<int, 2> arr;
  CartTopology<2> top;
  top.scatterArrayBlocked<int, 2, 2>(&arr, NULL, NULL, NULL);
  return 0;
}

0 Answers0