Serialization of arrays with and without automatic memory handling. More...
Serialization of arrays with and without automatic memory handling.
Specified (to serializer::operator&) via @code CnC::chunk< type[, allocator] >( your_ptr, len )
where your_ptr is a pointer variable to your array of <type>s.
If the allocator is the special type CnC::no_alloc, the runtime assumes that the programer appropriately allocates (if ser.is_unpacking()) and deallocates (if ser:is_cleaning_up()) the array. This implies that the using serialize method/function needs to make sure it passes valid and correct pointers to chunk.
If not CnC::no_alloc , the Allocator class must meet "allocator" requirements of ISO C++ Standard, Section 20.1.5
When unpacking, your_ptr must be NULL, and it is allocated automatically using the given allocator and when cleaning up, your_ptr is deallocated accordingly.
If using an allocator (in particular hre default std::allocator) object/array allocation and deallocation is greatly simplified for the programmer. There is no need to allocate and/or deallocate objects/arrays manually.