[libcxx-commits] [libcxx] bbb3d03 - [libcxx][ranges][nfc] moves view concepts into `__ranges/concepts.h`
Christopher Di Bella via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Jun 10 12:36:10 PDT 2021
Author: Christopher Di Bella
Date: 2021-06-10T19:35:00Z
New Revision: bbb3d03f93b86ccef7581f34c7582ebd70c80a19
URL: https://github.com/llvm/llvm-project/commit/bbb3d03f93b86ccef7581f34c7582ebd70c80a19
DIFF: https://github.com/llvm/llvm-project/commit/bbb3d03f93b86ccef7581f34c7582ebd70c80a19.diff
LOG: [libcxx][ranges][nfc] moves view concepts into `__ranges/concepts.h`
Added:
libcxx/include/__ranges/enable_view.h
Modified:
libcxx/include/CMakeLists.txt
libcxx/include/__ranges/concepts.h
libcxx/include/__ranges/view_interface.h
libcxx/include/ranges
Removed:
libcxx/include/__ranges/view.h
################################################################################
diff --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt
index 4fd566e4be506..e83b289b13a2f 100644
--- a/libcxx/include/CMakeLists.txt
+++ b/libcxx/include/CMakeLists.txt
@@ -50,8 +50,8 @@ set(files
__ranges/empty.h
__ranges/empty_view.h
__ranges/enable_borrowed_range.h
+ __ranges/enable_view.h
__ranges/view_interface.h
- __ranges/view.h
__ranges/size.h
__split_buffer
__std_stream
diff --git a/libcxx/include/__ranges/concepts.h b/libcxx/include/__ranges/concepts.h
index 4c044f52368ab..0a4e3c16a9e97 100644
--- a/libcxx/include/__ranges/concepts.h
+++ b/libcxx/include/__ranges/concepts.h
@@ -12,6 +12,7 @@
#include <__config>
#include <__iterator/concepts.h>
#include <__ranges/access.h>
+#include <__ranges/enable_view.h>
#include <__ranges/size.h>
#include <type_traits>
@@ -63,6 +64,24 @@ namespace ranges {
// `disable_sized_range` defined in `<__ranges/size.h>`
+ // [range.view], views
+
+ // `enable_view` defined in <__ranges/enable_view.h>
+ // `view_base` defined in <__ranges/enable_view.h>
+
+ template <class _Tp>
+ concept view =
+ range<_Tp> &&
+ movable<_Tp> &&
+ default_initializable<_Tp> &&
+ enable_view<_Tp>;
+
+ template<class _Range>
+ concept __simple_view =
+ view<_Range> && range<const _Range> &&
+ same_as<iterator_t<_Range>, iterator_t<const _Range>> &&
+ same_as<sentinel_t<_Range>, iterator_t<const _Range>>;
+
// [range.refinements], other range refinements
template <class _Tp>
concept input_range = range<_Tp> && input_iterator<iterator_t<_Tp> >;
diff --git a/libcxx/include/__ranges/view.h b/libcxx/include/__ranges/enable_view.h
similarity index 67%
rename from libcxx/include/__ranges/view.h
rename to libcxx/include/__ranges/enable_view.h
index 55f8928f3c597..cc5c359fab047 100644
--- a/libcxx/include/__ranges/view.h
+++ b/libcxx/include/__ranges/enable_view.h
@@ -7,8 +7,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef _LIBCPP___RANGES_VIEW_H
-#define _LIBCPP___RANGES_VIEW_H
+#ifndef _LIBCPP___RANGES_ENABLE_VIEW_H
+#define _LIBCPP___RANGES_ENABLE_VIEW_H
#include <__config>
#include <__ranges/concepts.h>
@@ -33,18 +33,6 @@ struct view_base { };
template <class _Tp>
inline constexpr bool enable_view = derived_from<_Tp, view_base>;
-template <class _Tp>
-concept view =
- range<_Tp> &&
- movable<_Tp> &&
- default_initializable<_Tp> &&
- enable_view<_Tp>;
-
-template<class _Range>
-concept __simple_view =
- view<_Range> && range<const _Range> &&
- same_as<iterator_t<_Range>, iterator_t<const _Range>> &&
- same_as<sentinel_t<_Range>, iterator_t<const _Range>>;
} // end namespace ranges
#endif // !_LIBCPP_HAS_NO_RANGES
@@ -53,4 +41,4 @@ _LIBCPP_END_NAMESPACE_STD
_LIBCPP_POP_MACROS
-#endif // _LIBCPP___RANGES_VIEW_H
+#endif // _LIBCPP___RANGES_ENABLE_VIEW_H
diff --git a/libcxx/include/__ranges/view_interface.h b/libcxx/include/__ranges/view_interface.h
index ffaab1d85d202..5d70a1e1c0dfd 100644
--- a/libcxx/include/__ranges/view_interface.h
+++ b/libcxx/include/__ranges/view_interface.h
@@ -15,7 +15,7 @@
#include <__iterator/prev.h>
#include <__ranges/access.h>
#include <__ranges/empty.h>
-#include <__ranges/view.h>
+#include <__ranges/enable_view.h>
#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/ranges b/libcxx/include/ranges
index dbfaadf885e79..9e5b55e369e2e 100644
--- a/libcxx/include/ranges
+++ b/libcxx/include/ranges
@@ -99,9 +99,9 @@ namespace std::ranges {
#include <__ranges/empty.h>
#include <__ranges/empty_view.h>
#include <__ranges/enable_borrowed_range.h>
+#include <__ranges/enable_view.h>
#include <__ranges/size.h>
#include <__ranges/view_interface.h>
-#include <__ranges/view.h>
#include <compare> // Required by the standard.
#include <initializer_list> // Required by the standard.
#include <iterator> // Required by the standard.
More information about the libcxx-commits
mailing list