By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,988 Members | 1,367 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,988 IT Pros & Developers. It's quick & easy.

C++ not-template base class of template base class

P: 31

I have a template class, which uses a class argument as a specifier of member types. It's basically a specific generic container, which has function return datatypes and variable datatypes depending on the template argument.
Now, I want to store a couple of these containers in a vector, but I want to be able to put instances of different template argument types in there. So I want to be able to put in a container of float, a container of int, whatever (by the way, you may wonder "why is he reinventing the wheel?", but these have to have specific functions and they're fit in to my design).
The problem is, although it's possible to let a template class inherit from a not-template base class (what would be necessary for storing in a vector), the base class has to have all functions already with fixed return datatypes.
But I need them to change depending on the template argument. Is that possible? Can I maybe somehow pass the argument to the base class?

Apr 24 '18 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.