Boost logo

Boost Users :

Subject: Re: [Boost-users] [smart_ptr] shared_count allocator
From: Ovanes Markarian (om_boost_at_[hidden])
Date: 2012-02-06 12:34:17


Alexey, hi!

On Mon, Feb 6, 2012 at 10:26 AM, Alexey Badyaev <leemouse_at_[hidden]> wrote:

> Hi All.
> I see in sources of the boost/smart_ptr library: shared_count object is
> allocated by shared_ptr via operator new.
> But I don't want allocate this object on a heap memory, but via my own
> allocator.
>
Take a look at synopsis.
http://www.boost.org/doc/libs/1_47_0/libs/smart_ptr/shared_ptr.htm#allocator_constructor

There is a constructor overload:

template<class Y, class D, class A> shared_ptr(Y * p, D d, A a);

As I understand it, this ctor will allocate internal shared_ptr resources
using an instance of Allocator A.

Can I do that in boost trunk? Or may be in a future versions of the boost?

Actually, this raises the question what will happen with boost::shared_ptr
after it made to C++11? Is it going to diverge from standard as an
additional feature experiment or go hand in hand with C++11 or become
obsolete for C++11 compilers?

With Kind Regards,
Ovanes



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net