I have a type with the following structure:
class Block
{
/* few fixed size fields*/
...
/* fixed size byte array*/
std::unique_ptr<std::uint8_t[]> data;
}
These objects are used in a work pipeline and there are gonna be a lot of such objects. Size of data
is a runtime parameter, but it's known before work starts and it doesn't change later.
I want to use a memory pool (boost::pool/boost::object_pool in particular) to preallocate a lot of such objects with the such layout that each Block
object is followed by it's data
array.
How can I achieve this?