|
Boost : |
Subject: Re: [boost] [smart_ptr] make_shared perfect forwarding bug
From: Peter Dimov (pdimov_at_[hidden])
Date: 2009-04-18 19:21:35
Frank Mori Hess:
> Perfect forwarding doesn't seem to work quite correctly with
> boost::make_shared. The attached program, which tries to pass a move-only
> type through make_shared fails to compile with gcc in c++0x mode. To fix
> it, I had to change the definition of detail::forward in make_shared.hpp
> to use rvalue references:
>
> #if defined( BOOST_HAS_RVALUE_REFS )
> template< class T > T&& forward( T &&t )
> {
> return t;
> }
> #endif
>
> This is just based on looking at how gcc implements std::forward. Is this
> the right fix?
Yes, I believe so. My original forward was incorrect. (We should probably
switch to std::forward at some point.)
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk