Boost logo

Boost :

Subject: Re: [boost] [move][unique_ptr] c++14 unique_ptr comes to town
From: Peter Dimov (lists_at_[hidden])
Date: 2014-08-27 19:13:05


Ion Gaztañaga wrote:
> Tested in several GCC, MSVC and Clang versions, both in C++03 and C++11
> modes. I won't have time in the following days to continue working in your
> proposed changes, but at least I wanted to to show that we've progressed a
> bit.

Thanks!

There's one other thing that I omitted in my last post:

85 template <class U>
86 unique_ptr_data(P p, BOOST_FWD_REF(U) d) BOOST_NOEXCEPT
87 : m_p(::boost::forward<U>(p)), d(::boost::forward<U>(d))
88 {}

It's not clear to me why you need this constructor (in addition to the two
others), and it's wrong - forward<U>(p) isn't likely to work.

In my implementation, I've went with perfect forwarding instead of the two
constructor signatures described in the standard. Combined with the
static_assert inside, It works for all cases. Not sure how this would
translate to C++03 though; what does BOOST_FWD_REF(U) expand into? C++03
can't really do perfect forwarding.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk