I realize similar questions have been asked before, but I read a couple of those and still don\'t see where I\'m going wrong. When I simply write my class without separating th
VisitedSet
is a template, not a class, so you can’t use VisitedSet
in a nested name specifier such as VisitedSet::getSize()
. Just as you specified the declaration of class VisitedSet
for all class T
, you must specify the definition of VisitedSet
for all class T
:
template
int VisitedSet::getSize() {
// ^^^
return vec.size();
}
The name of a template can, however, be used as though it were a class within a template definition:
template
struct Example {
Example* parent;
T x, y;
};
In this case, Example
is short for Example
.