forked from OSchip/llvm-project
[libcxx][ranges] Move `namespace views` into `namespace ranges` and add an alias.
Differential Revision: https://reviews.llvm.org/D108047
This commit is contained in:
parent
1f7b25ea76
commit
9ed0778179
|
@ -32,7 +32,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
|
|||
|
||||
#if !defined(_LIBCPP_HAS_NO_RANGES)
|
||||
|
||||
namespace views {
|
||||
namespace ranges::views {
|
||||
|
||||
namespace __all {
|
||||
struct __fn {
|
||||
|
@ -75,7 +75,7 @@ inline namespace __cpo {
|
|||
template<ranges::viewable_range _Range>
|
||||
using all_t = decltype(views::all(declval<_Range>()));
|
||||
|
||||
} // namespace views
|
||||
} // namespace ranges::views
|
||||
|
||||
#endif // !defined(_LIBCPP_HAS_NO_RANGES)
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
|
|||
|
||||
#if !defined(_LIBCPP_HAS_NO_RANGES)
|
||||
|
||||
namespace views {
|
||||
namespace ranges::views {
|
||||
|
||||
namespace __counted {
|
||||
template<class _From, class _To>
|
||||
|
@ -88,7 +88,7 @@ inline namespace __cpo {
|
|||
inline constexpr auto counted = __counted::__fn{};
|
||||
} // namespace __cpo
|
||||
|
||||
} // namespace views
|
||||
} // namespace ranges::views
|
||||
|
||||
#endif // !defined(_LIBCPP_HAS_NO_RANGES)
|
||||
|
||||
|
|
|
@ -366,7 +366,6 @@ namespace ranges {
|
|||
|
||||
template<class _Start, class _Bound>
|
||||
inline constexpr bool enable_borrowed_range<iota_view<_Start, _Bound>> = true;
|
||||
} // namespace ranges
|
||||
|
||||
namespace views {
|
||||
namespace __iota {
|
||||
|
@ -395,6 +394,7 @@ inline namespace __cpo {
|
|||
inline constexpr auto iota = __iota::__fn{};
|
||||
}
|
||||
} // namespace views
|
||||
} // namespace ranges
|
||||
|
||||
#endif // !defined(_LIBCPP_HAS_NO_RANGES)
|
||||
|
||||
|
|
|
@ -238,6 +238,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD
|
|||
|
||||
#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_RANGES)
|
||||
|
||||
namespace views = ranges::views;
|
||||
|
||||
#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_RANGES)
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
|
|
@ -142,6 +142,10 @@ constexpr bool test() {
|
|||
assert(std::ranges::end(subrange) == std::ranges::begin(subrange) + 8);
|
||||
}
|
||||
|
||||
{
|
||||
static_assert(std::same_as<decltype(std::views::all), decltype(std::ranges::views::all)>);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -195,6 +195,10 @@ constexpr bool test() {
|
|||
}
|
||||
}
|
||||
|
||||
{
|
||||
static_assert(std::same_as<decltype(std::views::counted), decltype(std::ranges::views::counted)>);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -71,6 +71,9 @@ constexpr bool test() {
|
|||
static_assert( std::is_invocable_v<decltype(std::views::iota), int, int>);
|
||||
static_assert(!std::is_invocable_v<decltype(std::views::iota), int, X>);
|
||||
}
|
||||
{
|
||||
static_assert(std::same_as<decltype(std::views::iota), decltype(std::ranges::views::iota)>);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue