[libcxx-commits] [libcxx] [libc++] Simplify the implementation of std::make_from_tuple (PR #215067)
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Aug 12 05:38:53 PDT 2026
================
@@ -1362,79 +1362,56 @@ struct uses_allocator<tuple<_Tp...>, _Alloc> : true_type {};
# if _LIBCPP_STD_VER >= 17
# define _LIBCPP_NOEXCEPT_RETURN(...) \
- noexcept(noexcept(__VA_ARGS__)) { return __VA_ARGS__; }
+ noexcept(noexcept(__VA_ARGS__)) { return __VA_ARGS__; } \
+ static_assert(true)
-// The _LIBCPP_NOEXCEPT_RETURN macro breaks formatting.
-// clang-format off
template <class _Fn, class _Tuple, size_t... _Id>
-inline _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto)
-__apply_tuple_impl(_Fn&& __f, _Tuple&& __t, index_sequence<_Id...>)
- _LIBCPP_NOEXCEPT_RETURN(std::__invoke(std::forward<_Fn>(__f), std::get<_Id>(std::forward<_Tuple>(__t))...))
+inline
+ _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) __apply_tuple_impl(_Fn&& __f, _Tuple&& __t, index_sequence<_Id...>)
+ _LIBCPP_NOEXCEPT_RETURN(std::__invoke(std::forward<_Fn>(__f), std::get<_Id>(std::forward<_Tuple>(__t))...));
template <class _Fn, class _Tuple>
inline _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) apply(_Fn&& __f, _Tuple&& __t)
- _LIBCPP_NOEXCEPT_RETURN(std::__apply_tuple_impl(
- std::forward<_Fn>(__f),
- std::forward<_Tuple>(__t),
- make_index_sequence<tuple_size_v<remove_reference_t<_Tuple>>>()))
+ _LIBCPP_NOEXCEPT_RETURN(std::__apply_tuple_impl(std::forward<_Fn>(__f),
+ std::forward<_Tuple>(__t),
+ make_index_sequence<tuple_size_v<remove_reference_t<_Tuple>>>()));
+# undef _LIBCPP_NOEXCEPT_RETURN
+
+template <class _Tp, class _Tuple, class _Seq = make_index_sequence<tuple_size_v<__remove_cvref_t<_Tuple>>>>
+inline constexpr bool __can_make_from_tuple_v = false;
-#if _LIBCPP_STD_VER >= 20
----------------
philnik777 wrote:
Huh, I've indeed misunderstood [structure.specifications]/4. I'll keep the constraint, since that's what was there before. IMO we should definitely consider whether we should keep that extension around though.
https://github.com/llvm/llvm-project/pull/215067
More information about the libcxx-commits
mailing list