I have a template class
template <class T> class myClass { public: private: typename T::Indices myIndices; };
Now in my main code I want to instantiate a template class depending on the condition. For instance:
myFunc( int operation) { switch (operation) { case 0:
Now the problem with this approach is that auto_ptr<> will die at the end of switch{} . And I can not declare it at the beginning of the function, because I do not know the type that will be created earlier.
I know that at compile time (using a template) I try to reach the runtime, but still wanted to know if there is a way to do this better.
source share