[libcxx][ranges] Move `namespace views` into `namespace ranges` and add an alias.

Differential Revision: https://reviews.llvm.org/D108047
This commit is contained in:
zoecarver 2021-08-13 11:36:55 -07:00
parent 1f7b25ea76
commit 9ed0778179
7 changed files with 18 additions and 5 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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

View File

@ -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;
}

View File

@ -195,6 +195,10 @@ constexpr bool test() {
}
}
{
static_assert(std::same_as<decltype(std::views::counted), decltype(std::ranges::views::counted)>);
}
return true;
}

View File

@ -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;
}