Skip to content

Commit

Permalink
<tuple>, <utility>: Make tuple-related functions ADL-proof (#4488)
Browse files Browse the repository at this point in the history
  • Loading branch information
frederick-vs-ja authored Mar 19, 2024
1 parent 2175098 commit 4787efe
Show file tree
Hide file tree
Showing 3 changed files with 222 additions and 105 deletions.
10 changes: 5 additions & 5 deletions stl/inc/tuple
Original file line number Diff line number Diff line change
Expand Up @@ -1053,7 +1053,7 @@ _NODISCARD constexpr typename _Tuple_cat1<_Tuples...>::_Ret tuple_cat(_Tuples&&.
using _Ret = typename _Cat1::_Ret;
using _Kx_seq = typename _Cat1::_Kx_seq;
using _Ix_seq = typename _Cat1::_Ix_seq;
return _Tuple_cat<_Ret>(_Kx_seq{}, _Ix_seq{}, _STD forward_as_tuple(_STD forward<_Tuples>(_Tpls)...));
return _STD _Tuple_cat<_Ret>(_Kx_seq{}, _Ix_seq{}, _STD forward_as_tuple(_STD forward<_Tuples>(_Tpls)...));
}

#if _HAS_CXX17
Expand All @@ -1073,9 +1073,9 @@ _EXPORT_STD template <class _Callable, _Tuple_like _Tuple>
_EXPORT_STD template <class _Callable, class _Tuple>
#endif // ^^^ !_HAS_CXX23 ^^^
constexpr decltype(auto) apply(_Callable&& _Obj, _Tuple&& _Tpl) noexcept(
noexcept(_Apply_impl(_STD forward<_Callable>(_Obj), _STD forward<_Tuple>(_Tpl),
noexcept(_STD _Apply_impl(_STD forward<_Callable>(_Obj), _STD forward<_Tuple>(_Tpl),
make_index_sequence<tuple_size_v<remove_reference_t<_Tuple>>>{}))) {
return _Apply_impl(_STD forward<_Callable>(_Obj), _STD forward<_Tuple>(_Tpl),
return _STD _Apply_impl(_STD forward<_Callable>(_Obj), _STD forward<_Tuple>(_Tpl),
make_index_sequence<tuple_size_v<remove_reference_t<_Tuple>>>{});
}

Expand All @@ -1097,10 +1097,10 @@ _EXPORT_STD template <class _Ty, _Tuple_like _Tuple>
#else // ^^^ _HAS_CXX23 / !_HAS_CXX23 vvv
_EXPORT_STD template <class _Ty, class _Tuple>
#endif // ^^^ !_HAS_CXX23 ^^^
_NODISCARD constexpr _Ty make_from_tuple(_Tuple&& _Tpl) noexcept(noexcept(_Make_from_tuple_impl<_Ty>(
_NODISCARD constexpr _Ty make_from_tuple(_Tuple&& _Tpl) noexcept(noexcept(_STD _Make_from_tuple_impl<_Ty>(
_STD forward<_Tuple>(_Tpl), make_index_sequence<tuple_size_v<remove_reference_t<_Tuple>>>{}))) /* strengthened */ {
// construct _Ty from the elements of _Tpl
return _Make_from_tuple_impl<_Ty>(
return _STD _Make_from_tuple_impl<_Ty>(
_STD forward<_Tuple>(_Tpl), make_index_sequence<tuple_size_v<remove_reference_t<_Tuple>>>{});
}
#endif // _HAS_CXX17
Expand Down
3 changes: 2 additions & 1 deletion stl/inc/utility
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,8 @@ struct pair { // store a pair of values

template <class _Tuple1, class _Tuple2, size_t... _Indices1, size_t... _Indices2>
constexpr pair(_Tuple1& _Val1, _Tuple2& _Val2, index_sequence<_Indices1...>, index_sequence<_Indices2...>)
: first(_Tuple_get<_Indices1>(_STD move(_Val1))...), second(_Tuple_get<_Indices2>(_STD move(_Val2))...) {}
: first(_STD _Tuple_get<_Indices1>(_STD move(_Val1))...),
second(_STD _Tuple_get<_Indices2>(_STD move(_Val2))...) {}

template <class... _Types1, class... _Types2>
_CONSTEXPR20 pair(piecewise_construct_t, tuple<_Types1...> _Val1, tuple<_Types2...> _Val2)
Expand Down
Loading

0 comments on commit 4787efe

Please sign in to comment.