From d1c4c755310e5c358cf999ddf223c43f9e5b3030 Mon Sep 17 00:00:00 2001 From: Arthur O'Dwyer Date: Sat, 29 Jan 2022 11:02:23 -0500 Subject: [PATCH] [libc++] Fix the last instances of `namespace ranges::inline...`. NFC. Make these look the same as everywhere else. --- libcxx/include/__concepts/swappable.h | 15 ++++++++------- libcxx/include/__iterator/iter_move.h | 15 ++++++++++----- libcxx/include/__iterator/iter_swap.h | 5 +++-- libcxx/include/__ranges/enable_view.h | 2 +- 4 files changed, 22 insertions(+), 15 deletions(-) diff --git a/libcxx/include/__concepts/swappable.h b/libcxx/include/__concepts/swappable.h index 423b3a8..d452497 100644 --- a/libcxx/include/__concepts/swappable.h +++ b/libcxx/include/__concepts/swappable.h @@ -28,13 +28,13 @@ _LIBCPP_BEGIN_NAMESPACE_STD #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_CONCEPTS) // [concept.swappable] -namespace ranges::__swap { - // Deleted to inhibit ADL + +namespace ranges { +namespace __swap { + template void swap(_Tp&, _Tp&) = delete; - - // [1] template concept __unqualified_swappable_with = (__class_or_enum> || __class_or_enum>) && @@ -89,11 +89,12 @@ namespace ranges::__swap { __y = _VSTD::exchange(__x, _VSTD::move(__y)); } }; -} // namespace ranges::__swap +} // namespace __swap -namespace ranges::inline __cpo { +inline namespace __cpo { inline constexpr auto swap = __swap::__fn{}; -} // namespace ranges::__cpo +} // namespace __cpo +} // namespace ranges template concept swappable = requires(_Tp& __a, _Tp& __b) { ranges::swap(__a, __b); }; diff --git a/libcxx/include/__iterator/iter_move.h b/libcxx/include/__iterator/iter_move.h index a2951f7..b72a5ec 100644 --- a/libcxx/include/__iterator/iter_move.h +++ b/libcxx/include/__iterator/iter_move.h @@ -25,7 +25,11 @@ _LIBCPP_BEGIN_NAMESPACE_STD #if !defined(_LIBCPP_HAS_NO_RANGES) -namespace ranges::__iter_move { +// [iterator.cust.move] + +namespace ranges { +namespace __iter_move { + void iter_move(); template @@ -69,14 +73,15 @@ struct __fn { // [iterator.cust.move]/1.3 // Otherwise, ranges::iter_move(E) is ill-formed. }; -} // namespace ranges::__iter_move +} // namespace __iter_move -namespace ranges::inline __cpo { +inline namespace __cpo { inline constexpr auto iter_move = __iter_move::__fn{}; -} +} // namespace __cpo +} // namespace ranges template<__dereferenceable _Tp> -requires requires(_Tp& __t) { { ranges::iter_move(__t) } -> __referenceable; } + requires requires(_Tp& __t) { { ranges::iter_move(__t) } -> __referenceable; } using iter_rvalue_reference_t = decltype(ranges::iter_move(declval<_Tp&>())); #endif // !_LIBCPP_HAS_NO_RANGES diff --git a/libcxx/include/__iterator/iter_swap.h b/libcxx/include/__iterator/iter_swap.h index a6c3bc8..d8fff5e 100644 --- a/libcxx/include/__iterator/iter_swap.h +++ b/libcxx/include/__iterator/iter_swap.h @@ -28,6 +28,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD #if !defined(_LIBCPP_HAS_NO_RANGES) +// [iter.cust.swap] + namespace ranges { namespace __iter_swap { template @@ -79,12 +81,11 @@ namespace __iter_swap { *_VSTD::forward<_T1>(__x) = _VSTD::move(__old); } }; -} // end namespace __iter_swap +} // namespace __iter_swap inline namespace __cpo { inline constexpr auto iter_swap = __iter_swap::__fn{}; } // namespace __cpo - } // namespace ranges template diff --git a/libcxx/include/__ranges/enable_view.h b/libcxx/include/__ranges/enable_view.h index e1daec0..70b2174 100644 --- a/libcxx/include/__ranges/enable_view.h +++ b/libcxx/include/__ranges/enable_view.h @@ -38,7 +38,7 @@ template inline constexpr bool enable_view = derived_from<_Tp, view_base> || requires { ranges::__is_derived_from_view_interface((_Tp*)nullptr, (_Tp*)nullptr); }; -} // end namespace ranges +} // namespace ranges #endif // !_LIBCPP_HAS_NO_RANGES -- 2.7.4