Is there an STL container or something else that gives the same functionality as Java’s Linked List or C#’s Array List? i.e appending different types into the same array like
List.Append(1);
List.Append("I am a string");
List.Append(True);
and dynamic functions like
List.Resize();
List.GetSize();
etc.?
If not , can u implement one yourself using templates etc.? If so, How?
It’s hard to implement this using templates because templates assume a single type for members. In C++ you’ll have to use polymorphism with a common source (which is available in Java and C# as a common “Object” parent for all the classes, IMHO).
You can try to do it using the boost library, and the
boost::variantorboost::any(choose which one fits your needs).