Problems with template template parameter

Dear all,

I am trying to use the template template parameters, and I am stuck on a code that does not compile, I do not know why.

Here is how I declare my class with template template parameter:

1
2
3
4
5
6
7
8
template<class T, template<class U> class OP>
class Component
{
 public:
  // ... several methods ... 
  XYZCoord      innExtr()
  std::set<int> addPointCheckTouchs(XYZCoord p, DistributedDataStruct<T>* labl); 
};


where [XYZCoord] and [DistributedDataStruct<T>] are previously defined classes.

Here is how I define and implement the method [addPointCheckTouchs]:

1
2
3
4
5
template<class T, template<class U> class OP>
std::set<int> Component<T,OP>::addPointCheckTouchs(XYZCoord p, DistributedDataStruct<T>* labl)
{
  //..implementation...
}



Here is how I call the concerned method in the main().
The last line is the one that does not compile

1
2
3
4
5
6
7
8
// .. instructions ..

std::vector<Component<unsigned short, Minimal > > vconn; //Minimal is a previously defined template

// .. instructions ..

XYZCoord vx0 = vconn[0].outExtr();
vconn[0].addPointCheckTouchs<unsigned short, Minimal>(vx0, labl);


I have tried to omit "<unsigned short, Minimal>", I get another error message, which is the following:

note: candidates are: std::set<int, std::less<int>, std::allocator<int> > Component<T, OP>::addPointCheckTouchs(XYZCoord, DistributedDataStruct<T>*) [with T = short unsigned int, OP = Minimal]

which is strange, as it is exactly how I define my method.

Maybe someone more expert than me could figure out what I am mising in that code.


I thank you all,
Panecasareccio


Could you post a minimal complete example or at least the entire compiler diagnostic for your second case? ("note:" is only one of several lines)

This:
vconn[0].addPointCheckTouchs(vx0, labl);
compiles for me, provided a suitable labl

As for specifying template arguments, addPointCheckTouchs is a non-template function so it cannot be followed by any.
Last edited on
Hi,

It seems to me that I am using some "too advanced" features of the templates. That code does not compile with g++ (linux) but now I see that it does with g++ for windows.

I will provide soon a more complete code.

thank you all,
Giuseppe
Topic archived. No new replies allowed.