3 ms·
In that case you would inject a function pointer to an allocator (and deallocator), however, the object constructor is the only thing which knows how to allocat
by sparkie 12y ago
In that case you would inject a function pointer to an allocator (and deallocator), however, the object constructor is the only thing which knows how to allocate the object - consider the jagged array example I gave, or even a linked list - the user has no idea how they're allocated if given just an opaque pointer.