473,385 Members | 1,893 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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

Hello,

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?

Thanks
Apr 24 '18 #1
0 1358

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

Similar topics

1
by: Vikas | last post by:
I have a template class called Base with child classes called Child1 and Child2 as follows: template <typename T> class Base { … }; class Child1 : Base<Concrete1>
17
by: Asfand Yar Qazi | last post by:
Basically this: //file 'B.hh' class B { protected: void f() {} }; //file 'C.hh'
9
by: Banaticus Bart | last post by:
I wrote an abstract base class from which I've derived a few other classes. I'd like to create a base class array where each element is an instance of a derived object. I can create a base class...
13
by: Walt Karas | last post by:
The following gives an error in the declaration of the member function x() of the class template Tpl, compiliing with a recent version of GCC under Solaris: class A { }; class B { }; ...
4
by: Nataraj M | last post by:
Hi, I just don't want anybody derive a class from my class. For example: /////////////////////// //MY CODE class MyClass { .... }; ///////////////////////
6
by: Alf P. Steinbach | last post by:
#include <iostream> struct Belcher { int x; void belch() { std::cout << x << std::endl; } Belcher( int anX ): x( anX ) {} }; struct Person: private Belcher { Person(): Belcher( 666 ) {} };
1
by: Bill Menees | last post by:
I've got a RichTextBoxEx inherited from RichTextBox, and I want to overload the TextLength property to use TextBoxBase's implementation of TextLength. But since TextBoxBase isn't my immediate base...
8
by: TS | last post by:
I am trying to get set a property of a control on the inherited class from base class. I imagine i have to use reflection, so could someone give me the code to do it? something like this?...
2
by: RitualDave | last post by:
I get a C2811 error when I compile the following (with the /clr switch): template <class T> ref class Base {}; template <template <class> class TBase> ref class Derived : TBase<int> {};
2
by: vilarneto | last post by:
Hello everyone, I'm facing a particular situation about template class derivation. The subject is old -- deriving a non-template class from a template base class -- but my problem is that the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.