The task of the following nature: You need a dynamic array that can take data of any type, for example, like vector.push_back, but any type. I need to serialize the data into this very array, which can take any data into itself, like an array.
I need this in order not to constantly create an array like this: [CLANG] char buffer [1024]; WriteInt4 (buffer, 50) WriteString (buffer, "hello")
foo (buffer.str (), buffer.lenght) [/ CLANG] And the data before calling foo will be this way (data in this order, you do not need to flip): 00 00 00 32 48 65 6c 6c 6f 00
Actually, how to be? I heard that there is std :: any, but I have no idea whether this is what I'm trying to find. boost I do not want to use.
I've also seen such code, it seems to be what you need, but it is inconvenient (not advertising): qaru.site/questions/7005490/possibility-of-store-object-type-for-stdany
How to be? I need a container that supports data output, as an array, and so that this array is filled in the order in which I will be pushing data into it.
qaru, to which you referred, simply automatically translates content from English SO? stackoverflow.com/questions/47705978/… - HolyBlackCat 11:12 pmstd::vector<unsigned char>with an overloaded / patternedpush_backthat will serialize the transferred objects to an internal vector, or will it not work? - HolyBlackCat