[libcxx-commits] [PATCH] D66262: Constrain tuple/unique_ptr move constructors (2899)
Louis Dionne via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Aug 15 08:48:06 PDT 2019
ldionne added inline comments.
================
Comment at: libcxx/include/memory:2489
_LIBCPP_INLINE_VISIBILITY
- unique_ptr(unique_ptr&& __u) _NOEXCEPT
+ unique_ptr(unique_ptr&& __u, typename enable_if<
+ is_move_constructible<_Dummy>::value,
----------------
Any reason for preferring this style of `enable_if` (as a default argument) as opposed to using a default _template_ argument?
================
Comment at: libcxx/include/memory:2514
+ template<class _Dummy = typename remove_const<typename remove_reference<_Dp>::type>::type>
_LIBCPP_INLINE_VISIBILITY
----------------
zoecarver wrote:
> The issue said to use `is_move_assignable_v<D>` but, that will cause some deleters to break. Thoughts on a better way to resolve this? Or should we make people change how they pass their deleter types?
Deleters are allowed to be lvalue references to function objects, so I don't think you want to use `remove_reference` here (nor `remove_const`). I think it is expected that a `unique_ptr<T, Deleter const&>` should be expected _not_ to be move assignable.
Repository:
rCXX libc++
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D66262/new/
https://reviews.llvm.org/D66262
More information about the libcxx-commits
mailing list