I want to do:
typedef MyTemplateClass<Type01, Type02> TClass;
TClass t;
TClass::InnerClass i;
i.test();
i think the solution could be:
template <typename A, typename B>
class MyTemplateClass
{
public:
class InnerClass
{
//here I can do stuff with A and B
A test() { return 0; }
};
friend class InnerClass;
};
but I want to have ma templates in separate *.inl file included at the bottom of header file
how to define such behaviour in other file?
when i do just
//file.inl
class InnerClass
{
//here I can do stuff with A and B
A test() { return 0; }
};
A and B are undefined.
but
template <typename A, typename B>
class InnerClass
{
...
};
makes my method template independent of MyTemplateClass types…
Once again in one sentence:
How to make InnerClass of MyTemplateClass in other file with providing
TClass::InnerClass i;
i.test();
behaviour?
You can’t. In a nutshell. Templates must be wholly defined before instantiation- that means that whatever you do, you’ll have to define the inner class in the template class anyway.