Disclaimer: I am afraid the short answer to my question is "not possible". But since I am not a C++ expert, I thought I still give it a try and ask here, maybe there is some kind of solution which I am just not aware of.
So I have templated container-like class MyContainer
that internally stores data in a std::list<T>
, where T
is the class template type. This works fine.
Now I want to add another class, which has to map instances of that templated container class in a std::map<std::string, MyContainer>
. However, the compiler asks me to provide the template class type for the value-part of the map, as in std::map<std::string, MyContainer<T>>
. But I would rather omit this template here, since that would in turn require me to use templates for the wrapper class as well.
Thus my question: Is there a way to achieve what I am trying to do, omitting the template type for the wrapper class, at least to some extend? Or is this just not possible in C++, because the compiler needs that information in any case?
Aucun commentaire:
Enregistrer un commentaire