El 28/08/2014 1:13, Peter Dimov escribió:
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.
Apart from the useless "forward<>()" (which I think will work as pointers are not move-enabled), if I disable this overload some compilers complain about move-only deleters not being copyable in C++03. I haven't investigated the issue, it might be provoked from some SFINAE provoked instantiations or compiler bugs. I'll try to simplify this if I find a way.
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_FWD_REF(U) expands to const U &, which means that non-const references can't be forwarded to constructors. That could be somewhat workarounded using an utility like boost::ref internally, but I think deleter_arg_type1/2 allow a more portable C++03/C++11 implementation. Best, Ionest, Ion
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost