+ 2
C++ Arrays
Is there a type of array in C++ that can hold different types of data? (Like lists in Python)
9 Answers
+ 2
Not really, but a clever idea is to create a base class for all other types and make an array of that type. This way, all of thoae elwments can be stored there as pointers of the base class. For other things, I do not think so, but not sure
+ 2
Okay, I'll have to learn more about those, thanks!
+ 2
You can create a Union for all different types. That dont use so much memory such a Class or a Struct.
+ 1
You mean, using templates?
+ 1
If i dont rember awrong, Boost has some ds for this
0
nono, like creating a class A and derive that class in other classes
0
Additionaly, if you would need a dictionary in c++, there is a std::map, maybe that helps a little too
0
Np, have a great coding time!!
0
Hello everyone, could someone give me an example of how it works? I can hardly imagine.
int x[3][3][2]= ?
int x[3][3][2]={{{},{}},{{},{}},{{},{}}} Like this? but where place values???
I just don't think I'll ever use that ..