I need to code a class that recieves a collection with any number of elements of any 'primitive' type. I also need to be able to know the type of each member (or at least the size of the type). The purpose of this class is to serialize the elements to store them in a file in fixed length registers.
Is this posible?
I know that C++ is statically typed and that there's no common parent regarding inheritance (such as Object in Java). So, I cannot recieve an array or a vector, as all the elements should have the same type.
I also thought of an array of pointers, but in such way I wouldn't know the elements type or its size.
Any ideas?
PS: couldn't find similar question, but if it exists, please redirectme.