
Hi, Is there an interest in a scoped_ptr that receives a Allocator parameter? I've been needing this in some libraries I've been developing. It could use EBO for the Allocator parameter to have the same size as scoped_ptr for empty Allocators. I need a move_ptr with a Allocator parameter too. But I rather let somebody else write for now. Thanks, -- Felipe Magno de Almeida

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Friday 11 September 2009, Felipe Magno de Almeida wrote:
Hi,
Is there an interest in a scoped_ptr that receives a Allocator parameter?
I don't understand. I didn't think scoped_ptr did any allocations.
I've been needing this in some libraries I've been developing. It could use EBO for the Allocator parameter to have the same size as scoped_ptr for empty Allocators. I need a move_ptr with a Allocator parameter too. But I rather let somebody else write for now.
Thanks,
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAkqqRNwACgkQ5vihyNWuA4UdlACgyHApi25VU+5ZcOp1X8GWF6Iu KrUAmwf7dyj9/p8X2TNU3UScU426C5xU =a4t3 -----END PGP SIGNATURE-----

On Fri, Sep 11, 2009 at 9:38 AM, Frank Mori Hess <frank.hess@nist.gov> wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On Friday 11 September 2009, Felipe Magno de Almeida wrote:
Hi,
Is there an interest in a scoped_ptr that receives a Allocator parameter?
I don't understand. I didn't think scoped_ptr did any allocations.
It doesn't, but it calls delete. Which is not appropriate when using an Allocator. Though a make_scoped_ptr would be quite handy too for a scoped_ptr with Allocator support. [snip] -- Felipe Magno de Almeida

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Friday 11 September 2009, Felipe Magno de Almeida wrote:
On Friday 11 September 2009, Felipe Magno de Almeida wrote:
Hi,
Is there an interest in a scoped_ptr that receives a Allocator parameter?
I don't understand. I didn't think scoped_ptr did any allocations.
It doesn't, but it calls delete. Which is not appropriate when using an Allocator. Though a make_scoped_ptr would be quite handy too for a scoped_ptr with Allocator support.
unique_ptr has deleter and move support. Maybe a boost::unique_ptr would be better to have than an enhanced scoped_ptr and a move_ptr? -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAkqqUZQACgkQ5vihyNWuA4W9YwCghlkswW+vF+a8ey4Ox+sGSlEj +nsAoKF2wDS4w2uPNx3jJeGTbJiuE1ge =CN2i -----END PGP SIGNATURE-----

On Fri, Sep 11, 2009 at 10:33 AM, Frank Mori Hess <frank.hess@nist.gov> wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
[snip]
unique_ptr has deleter and move support. Maybe a boost::unique_ptr would be better to have than an enhanced scoped_ptr and a move_ptr?
Probably. Though a scoped_ptr has a more restrict meaning, so it is useful too. But I'm not very strong about it. Also, it is easier to create a make_unique_ptr with a Allocator parameter because of the move support. Where is unique_ptr? I can't find it in the documentation. -- Felipe Magno de Almeida

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Friday 11 September 2009, Felipe Magno de Almeida wrote:
Where is unique_ptr? I can't find it in the documentation.
Oh, I was just referring to the design of std::unique_ptr from c++0x, although I do see that boost interprocess has a unique_ptr in boost/interprocess/smart_ptr/unique_ptr.hpp (I don't have experience with it though). -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAkqqVX0ACgkQ5vihyNWuA4V81ACgrocehCPxvhD+Rs8nmQYJHORf Jq8An0LsBJW2T9RyA6ACmSeTj/50ZkjX =3KfJ -----END PGP SIGNATURE-----

Am Friday 11 September 2009 14:42:58 schrieb Felipe Magno de Almeida:
On Fri, Sep 11, 2009 at 9:38 AM, Frank Mori Hess <frank.hess@nist.gov> wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On Friday 11 September 2009, Felipe Magno de Almeida wrote:
Hi,
Is there an interest in a scoped_ptr that receives a Allocator parameter?
I don't understand. I didn't think scoped_ptr did any allocations.
It doesn't, but it calls delete. Which is not appropriate when using an Allocator. Though a make_scoped_ptr would be quite handy too for a scoped_ptr with Allocator support.
then you're looking for a deleter, as implemented by boost shared_ptr. I'm not sure what the benefit would be of implementing a deleter for scoped_ptr. deleters execute arbitrary code when the contained object is deleted. for a scoped_ptr, that code already has a place to go: a destructor. scoped_ptr just automates the common behaviour of a destructor, deleting an exclusively owned pointer. if you need to do something else, you can do so in a destructor.
participants (3)
-
Felipe Magno de Almeida
-
Frank Mori Hess
-
Stefan Strasser