4 ms·
> does modern C++ have a better solution to implement the same thing? No, the only standard way is to allocate a buffer large enough, and placement new the hea
by planede 4y ago
> does modern C++ have a better solution to implement the same thing?
No, the only standard way is to allocate a buffer large enough, and placement new the header and the bulk payload separately. The manual handling of alignment makes this very cumbersome.
Flexible array members would be nice, but I don't like that it is yet an other overload on some array declaration syntax (other meanings of "T x[]": 1) declare an array of unknown size, 2) in a definition, deduce the size). For some reason C likes to overload the array declaration syntax with widely different meanings (looking at you, VLAs).