[libcxx-commits] [libcxx] [libc++] Simplify the implementation of std::make_from_tuple (PR #215067)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Mon Aug 10 08:50:24 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
----------------
ldionne wrote:

This dates back to 31a9a4b83720. I'd be curious to have @frederick-vs-ja 's take on this from the point of view of the LWG issue.

I don't think we were using extensions in the code base back then, so that might be why we ended up with different code paths for C++20 and below.

https://github.com/llvm/llvm-project/pull/215067


More information about the libcxx-commits mailing list