When specifying an amount or size_type to the allocate member of the std::allocator, how does that value translate to :perator new with respect to the number of bytes requested?
Is it like malloc()?
When specifying an amount or size_type to the allocate member of the std::allocator, how does that value translate to :perator new with respect to the number of bytes requested?
Is it like malloc()?
Just as with malloc(), the amount of memory to be allocated is determined as n*size, where n is the number of objects to be allocated, and size is the size of an individual object.
The difference is, however, that a std::allocator also constructs the elements of the array (i.e. invokes constructors for class types) which malloc() and ::operator new() do not.