I know that after a forward declaration such as
class Foo;
I can declare a variable as Foo*
or Foo&
, but not Foo
.
If I have a templated class and instantiation
template<class T>
class Bar {
public:
T baz;
};
...
Bar<Foo> v;
how would the above rule apply? Would Foo have to have been fully declared (as opposed to only forward declared) at the point the class Bar
is defined, or at the point v
is declared? Or maybe it only has to be at one point that Bar<Foo>
is used anywhere in the source files, and all the others it is not? Something else?
Thanks