Skip to content

Commit e497f68

Browse files
committed
[NFC][libc++] Formats tuple.
The fix used macros that confuses clang-format. This is formatted with clang-format and then excluded from formatting.
1 parent 18ec330 commit e497f68

File tree

1 file changed

+18
-14
lines changed

1 file changed

+18
-14
lines changed

libcxx/include/tuple

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1416,25 +1416,27 @@ inline constexpr size_t tuple_size_v = tuple_size<_Tp>::value;
14161416
# define _LIBCPP_NOEXCEPT_RETURN(...) \
14171417
noexcept(noexcept(__VA_ARGS__)) { return __VA_ARGS__; }
14181418

1419+
// The _LIBCPP_NOEXCEPT_RETURN macro breaks formatting.
1420+
// clang-format off
14191421
template <class _Fn, class _Tuple, size_t... _Id>
14201422
inline _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto)
14211423
__apply_tuple_impl(_Fn&& __f, _Tuple&& __t, __tuple_indices<_Id...>)
14221424
_LIBCPP_NOEXCEPT_RETURN(std::__invoke(std::forward<_Fn>(__f), std::get<_Id>(std::forward<_Tuple>(__t))...))
14231425

1424-
template <class _Fn, class _Tuple>
1425-
inline _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) apply(_Fn&& __f, _Tuple&& __t) _LIBCPP_NOEXCEPT_RETURN(
1426-
std::__apply_tuple_impl(std::forward<_Fn>(__f),
1427-
std::forward<_Tuple>(__t),
1428-
typename __make_tuple_indices<tuple_size_v<remove_reference_t<_Tuple>>>::type{}))
1426+
template <class _Fn, class _Tuple>
1427+
inline _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) apply(_Fn&& __f, _Tuple&& __t)
1428+
_LIBCPP_NOEXCEPT_RETURN(std::__apply_tuple_impl(
1429+
std::forward<_Fn>(__f),
1430+
std::forward<_Tuple>(__t),
1431+
typename __make_tuple_indices<tuple_size_v<remove_reference_t<_Tuple>>>::type{}))
14291432

1430-
template <class _Tp, class _Tuple, size_t... _Idx>
1431-
inline _LIBCPP_HIDE_FROM_ABI constexpr _Tp
1432-
__make_from_tuple_impl(_Tuple&& __t, __tuple_indices<_Idx...>)
1433-
_LIBCPP_NOEXCEPT_RETURN(_Tp(std::get<_Idx>(std::forward<_Tuple>(__t))...))
1433+
template <class _Tp, class _Tuple, size_t... _Idx>
1434+
inline _LIBCPP_HIDE_FROM_ABI constexpr _Tp __make_from_tuple_impl(_Tuple&& __t, __tuple_indices<_Idx...>)
1435+
_LIBCPP_NOEXCEPT_RETURN(_Tp(std::get<_Idx>(std::forward<_Tuple>(__t))...))
14341436

1435-
template <class _Tp, class _Tuple>
1436-
inline _LIBCPP_HIDE_FROM_ABI constexpr _Tp
1437-
make_from_tuple(_Tuple&& __t) _LIBCPP_NOEXCEPT_RETURN(std::__make_from_tuple_impl<_Tp>(
1437+
template <class _Tp, class _Tuple>
1438+
inline _LIBCPP_HIDE_FROM_ABI constexpr _Tp make_from_tuple(_Tuple&& __t)
1439+
_LIBCPP_NOEXCEPT_RETURN(std::__make_from_tuple_impl<_Tp>(
14381440
std::forward<_Tuple>(__t), typename __make_tuple_indices<tuple_size_v<remove_reference_t<_Tuple>>>::type{}))
14391441

14401442
# undef _LIBCPP_NOEXCEPT_RETURN
@@ -1443,9 +1445,11 @@ __apply_tuple_impl(_Fn&& __f, _Tuple&& __t, __tuple_indices<_Id...>)
14431445

14441446
#endif // !defined(_LIBCPP_CXX03_LANG)
14451447

1446-
_LIBCPP_END_NAMESPACE_STD
1448+
_LIBCPP_END_NAMESPACE_STD
1449+
1450+
_LIBCPP_POP_MACROS
14471451

1448-
_LIBCPP_POP_MACROS
1452+
// clang-format on
14491453

14501454
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
14511455
# include <exception>

0 commit comments

Comments
 (0)