J
Juha Nieminen
If we have a custom allocator (eg. given to us as a template
parameter), the proper way of allocating an object using it is like:
Allocator alloc;
Allocator:ointer ptr = alloc.allocate(1);
alloc.construct(ptr, Type(5));
The problem with this is that it requires 'Type' to have a copy
constructor. It might not have one (ie. it might be disabled). Having
the copy constructor disabled doesn't stop an object from being
allocated with 'new'. But how to allocate it with an allocator?
parameter), the proper way of allocating an object using it is like:
Allocator alloc;
Allocator:ointer ptr = alloc.allocate(1);
alloc.construct(ptr, Type(5));
The problem with this is that it requires 'Type' to have a copy
constructor. It might not have one (ie. it might be disabled). Having
the copy constructor disabled doesn't stop an object from being
allocated with 'new'. But how to allocate it with an allocator?