I have a couple of questions about combining smart pointers and STL
allocators.
First of all, am I right in assuming that I can use the shared_*
templates right out of the box, as long as I define a custom deleter
that uses the allocator's deallocate function?
But if that's so, how exactly is it done? Part of my confusion comes
from the fact that the STL allocator documentation I've come across
isn't exactly clear on the semantics of allocators (I don't have a copy
of the standard). For instance, I'm not 100% sure whether or not I have
to call construct() after allocate() and destroy() before deallocate().
This is what I have so far:
class allocator_helper
{
public:
allocator_helper(allocator_type& a) : a_(a)
{}
void operator()(void const* p) const
{
a_.deallocate(static_cast