A
aaragon
Hello everyone,
I run across this problem:
I have a project that has a class with a template function, something
like the following:
class SomeClass {
....
public:
template <PROPERTY P>
inline typename PropertyTraits<P,GraphType>:ropertyType Map() {
return boost::get(typename
PropertyTraits<P,GraphType>:ropertyTag(), *g_);
}
....
};
so you can see that this function takes an enumerated type:
enum PROPERTY { POINT, WEIGHT};
// define local classes
template <PROPERTY, class Graph>
class PropertyTraits;
template <class Graph>
struct PropertyTraits<POINT,Graph> {
typedef vertex_point_t PropertyTag;
typedef typename boost:roperty_map<Graph, PropertyTag>::type
PropertyType;
};
template <class Graph>
struct PropertyTraits<WEIGHT,Graph> {
typedef edge_weight_t PropertyTag;
typedef typename boost:roperty_map<Graph, PropertyTag>::type
PropertyType;
};
Now, in some other code, I have a function template that takes as a
template parameter an object that can be an object of SomeClass.
class OtherClass {
....
template <class CL>
void operator()(CL& c) {
...
mvac_.template Map<POINT>()
...
}
....
};
Now, when I do this, the compiler says:
domain.h:638: error: 'POINT' was not declared in this scope
and this is ok because I don't want the code of OtherClass to know
about any enumerated types or classes in the first project. I tried
replacing POINT by 0 and it compiles, but then when I have to compile
the original code I have:
domain.h:638: error: no matching function for call to 'mvac::mVAC3<2,
mvac:omainTraits<2> >::Map()'
Does anyone knows how can I call this template function? Thank you
all,
aa
I run across this problem:
I have a project that has a class with a template function, something
like the following:
class SomeClass {
....
public:
template <PROPERTY P>
inline typename PropertyTraits<P,GraphType>:ropertyType Map() {
return boost::get(typename
PropertyTraits<P,GraphType>:ropertyTag(), *g_);
}
....
};
so you can see that this function takes an enumerated type:
enum PROPERTY { POINT, WEIGHT};
// define local classes
template <PROPERTY, class Graph>
class PropertyTraits;
template <class Graph>
struct PropertyTraits<POINT,Graph> {
typedef vertex_point_t PropertyTag;
typedef typename boost:roperty_map<Graph, PropertyTag>::type
PropertyType;
};
template <class Graph>
struct PropertyTraits<WEIGHT,Graph> {
typedef edge_weight_t PropertyTag;
typedef typename boost:roperty_map<Graph, PropertyTag>::type
PropertyType;
};
Now, in some other code, I have a function template that takes as a
template parameter an object that can be an object of SomeClass.
class OtherClass {
....
template <class CL>
void operator()(CL& c) {
...
mvac_.template Map<POINT>()
...
}
....
};
Now, when I do this, the compiler says:
domain.h:638: error: 'POINT' was not declared in this scope
and this is ok because I don't want the code of OtherClass to know
about any enumerated types or classes in the first project. I tried
replacing POINT by 0 and it compiles, but then when I have to compile
the original code I have:
domain.h:638: error: no matching function for call to 'mvac::mVAC3<2,
mvac:omainTraits<2> >::Map()'
Does anyone knows how can I call this template function? Thank you
all,
aa