unique_ptr for C++0x exprimental compilers?

Hi, Is there anybody already implementing an auto_ptr replacement (unique_ptr) for Boost? I've got a really simple implementation that I'm attaching to this email (with tests) that I'm submitting for review. HTH -- Dean Michael Berris | Software Engineer, Friendster, Inc. blog.cplusplus-soup.com | twitter.com/mikhailberis | linkedin.com/in/mikhailberis | profiles.friendster.com/mikhailberis | deanberris.com

Hi Dean, quick question. In line 31 of the header, why do you have this unique pointer forward declaration here? I mean you're defining the class just below. Just wondering. Thanks for this implementation. Christian On Thu, Jun 4, 2009 at 4:24 AM, Dean Michael Berris <mikhailberis@gmail.com> wrote:
Hi,
Is there anybody already implementing an auto_ptr replacement (unique_ptr) for Boost? I've got a really simple implementation that I'm attaching to this email (with tests) that I'm submitting for review.
HTH
-- Dean Michael Berris | Software Engineer, Friendster, Inc. blog.cplusplus-soup.com | twitter.com/mikhailberis | linkedin.com/in/mikhailberis | profiles.friendster.com/mikhailberis | deanberris.com
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Hi Christian, On Thu, Jun 4, 2009 at 10:13 PM, Christian Henning <chhenning@gmail.com> wrote:
Hi Dean, quick question. In line 31 of the header, why do you have this unique pointer forward declaration here? I mean you're defining the class just below. Just wondering.
Thanks for this implementation.
Oh, I was originally thinking of doing two different implementations -- one for C++0x and another for C++03. The forward declaration was supposed to be just before the point where I'd have an #if that chose which implementation to choose. I was then having some problems with the C++03 implementation since I couldn't think of a way to make unique_ptr<> non-copy-constructible but move-constructible (so that it could be returned from functions). So I left the forward declaration there and forgot about it in the end. :) -- Dean Michael Berris | Software Engineer, Friendster, Inc. blog.cplusplus-soup.com | twitter.com/mikhailberis | linkedin.com/in/mikhailberis | profiles.friendster.com/mikhailberis | deanberris.com

Hi, ----- Original Message ----- From: "Dean Michael Berris" <mikhailberis@gmail.com> To: <boost@lists.boost.org> Sent: Thursday, June 04, 2009 10:24 AM Subject: [boost] unique_ptr for C++0x exprimental compilers?
Hi,
Is there anybody already implementing an auto_ptr replacement (unique_ptr) for Boost? I've got a really simple implementation that I'm attaching to this email (with tests) that I'm submitting for review.
Howard Hinnant has already provided an implementation. See (https://svn.boost.org/trac/boost/wiki/LibrariesUnderConstruction#Boost.Smart...). I don't know if he plans to submit it for Boost review. Best, Vicente

Hi Vicente, On Fri, Jun 5, 2009 at 1:07 AM, vicente.botet <vicente.botet@wanadoo.fr> wrote:
Hi, ----- Original Message ----- From: "Dean Michael Berris" <mikhailberis@gmail.com> To: <boost@lists.boost.org> Sent: Thursday, June 04, 2009 10:24 AM Subject: [boost] unique_ptr for C++0x exprimental compilers?
Hi,
Is there anybody already implementing an auto_ptr replacement (unique_ptr) for Boost? I've got a really simple implementation that I'm attaching to this email (with tests) that I'm submitting for review.
Howard Hinnant has already provided an implementation. See (https://svn.boost.org/trac/boost/wiki/LibrariesUnderConstruction#Boost.Smart...).
I don't know if he plans to submit it for Boost review.
Thanks for the link. I read through his implementation and it uses simulated move for C++03, but doesn't use C++0x rvalue references when they're available. I'm guess it shouldn't take too much to use some compiler macro magic to choose between an implementation that uses rvalue references (like the one I posted) and a simulated rvalue reference / move / forward. I really hope Howard's implementation gets reviewed and packaged into Boost sooner than later. ;) -- Dean Michael Berris | Software Engineer, Friendster, Inc. blog.cplusplus-soup.com | twitter.com/mikhailberis | linkedin.com/in/mikhailberis | profiles.friendster.com/mikhailberis | deanberris.com

2009/6/5 Dean Michael Berris <mikhailberis@gmail.com>:
I really hope Howard's implementation gets reviewed and packaged into Boost sooner than later. ;)
I think the plan is to use Ion's move library to implement it. Sandbox: https://svn.boost.org/trac/boost/browser/sandbox/move ZIP file with docs: http://www.drivehq.com/web/igaztanaga/move.zip Online docs: http://www.drivehq.com/web/igaztanaga/libs/move/ Daniel

On Fri, Jun 5, 2009 at 7:22 PM, Daniel James<daniel_james@fmail.co.uk> wrote:
2009/6/5 Dean Michael Berris <mikhailberis@gmail.com>:
I really hope Howard's implementation gets reviewed and packaged into Boost sooner than later. ;)
I think the plan is to use Ion's move library to implement it.
Sounds like a good plan to me. Is Ion's move library already accepted? Has it been reviewed yet? [snip] Thanks for the links! -- Dean Michael Berris | Software Engineer, Friendster, Inc. blog.cplusplus-soup.com | twitter.com/mikhailberis | linkedin.com/in/mikhailberis | profiles.friendster.com/mikhailberis | deanberris.com

Dean Michael Berris wrote:
Is there anybody already implementing an auto_ptr replacement (unique_ptr) for Boost? I've got a really simple implementation that I'm attaching to this email (with tests) that I'm submitting for review.
There are already implementations that also work in C++03.
participants (5)
-
Christian Henning
-
Daniel James
-
Dean Michael Berris
-
Mathias Gaunard
-
vicente.botet