Reputation: 15955
I want to do something like this, but I'm not sure if it is possible. I can't find any information on Google.
template <typename T>
class Container {
public:
T *ptr;
};
class Other {
private:
Container *container_ref;
}
Thanks for the help.
Upvotes: 2
Views: 67
Reputation: 308120
No. A template isn't a class, it's the instructions for how to build a class. Without the template parameters (either explicit or implied) it isn't complete.
You could look into Boost::any for a solution to your problem.
Upvotes: 2
Reputation: 81349
It's not, but if you are in charge of Container
then you can make it inherit from a non-templated base class and keep a pointer to that.
Upvotes: 5