[libcxx-commits] [PATCH] D116621: [libc++][P2321R2] Add const overloads to tuple swap, construction and assignment

Eric Fiselier via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Mar 25 09:25:00 PDT 2022


EricWF added inline comments.


================
Comment at: libcxx/include/tuple:994
     struct _EnableImplicitMoveFromPair : _And<
-        is_constructible<_FirstType<_DependentTp...>, _Up1>,
-        is_constructible<_SecondType<_DependentTp...>, _Up2>,
-        is_convertible<_Up1, _FirstType<_DependentTp...> >, // explicit check
-        is_convertible<_Up2, _SecondType<_DependentTp...> >
-    > { };
+        is_convertible<_Up1, _FirstType<_DependentTp...> >,
+        is_convertible<_Up2, _SecondType<_DependentTp...> >,
----------------
If we don't have 2 types in the tuple, we shouldn't even be attempting this `is_convertible` check on the first one.

Don't instantiate any constructability/convertability checks in tuple if there are obvious reasons why the constructor evaluating them shouldn't be chosen, such as the arity.


================
Comment at: libcxx/include/tuple:1125
     _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
     tuple& operator=(_If<_And<is_move_assignable<_Tp>...>::value, tuple, __nat>&& __tuple)
         _NOEXCEPT_((_And<is_nothrow_move_assignable<_Tp>...>::value))
----------------
Are we implementing this for `std::array` too?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D116621/new/

https://reviews.llvm.org/D116621



More information about the libcxx-commits mailing list