I have a static class method that needs access to a pointer MyTypePointer that therefore has to be declared static. Since it is a template class I have to put the methods inside the header file but I can't define MyTypePointer in the header.
So I get the "undefined Reference" error since MyTypePointer is not declared. How can I make this work / declare MyTypePointer.
myclass.h
template <typename A, typename B>
class PathfindingClass {
typedef std::vector<GenericEdgeClass<A, B>*> MyType;
static MyType *MyTypePointer;
};
template <typename A, B>
void MyClass<A, B>::MyMethod(int x, int y) {
//do something with MyTypePointer
}
Thank you very much.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…