[libcxx-commits] [PATCH] D115422: [libc++][ranges] Add subsumption tests to `[special.mem.concepts]`.
Konstantin Varlamov via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Dec 8 20:25:57 PST 2021
var-const created this revision.
var-const requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.
Test that `nothrow-forward-iterator` subsumes `nothrow-input-iterator`
and likewise `nothrow-forward-range` subsumes `nothrow-input-range`.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D115422
Files:
libcxx/test/libcxx/algorithms/specialized.algorithms/special.mem.concepts/nothrow_forward_iterator.compile.pass.cpp
libcxx/test/libcxx/algorithms/specialized.algorithms/special.mem.concepts/nothrow_forward_range.compile.pass.cpp
Index: libcxx/test/libcxx/algorithms/specialized.algorithms/special.mem.concepts/nothrow_forward_range.compile.pass.cpp
===================================================================
--- libcxx/test/libcxx/algorithms/specialized.algorithms/special.mem.concepts/nothrow_forward_range.compile.pass.cpp
+++ libcxx/test/libcxx/algorithms/specialized.algorithms/special.mem.concepts/nothrow_forward_range.compile.pass.cpp
@@ -12,6 +12,7 @@
// template<class R>
// concept __nothrow_forward_range;
+#include <array>
#include <memory>
#include "test_iterators.h"
@@ -33,3 +34,12 @@
static_assert(!std::ranges::__nothrow_forward_range<test_range<cpp20_input_iterator>>);
static_assert(std::ranges::forward_range<test_range<ForwardProxyIterator>>);
static_assert(!std::ranges::__nothrow_forward_range<test_range<ForwardProxyIterator>>);
+
+constexpr bool forward_subsumes_input(std::ranges::__nothrow_forward_range auto)
+ requires true {
+ return true;
+}
+constexpr bool forward_subsumes_input(std::ranges::__nothrow_input_range auto);
+
+constexpr std::array<int, 3> array{};
+static_assert(forward_subsumes_input(array));
Index: libcxx/test/libcxx/algorithms/specialized.algorithms/special.mem.concepts/nothrow_forward_iterator.compile.pass.cpp
===================================================================
--- libcxx/test/libcxx/algorithms/specialized.algorithms/special.mem.concepts/nothrow_forward_iterator.compile.pass.cpp
+++ libcxx/test/libcxx/algorithms/specialized.algorithms/special.mem.concepts/nothrow_forward_iterator.compile.pass.cpp
@@ -31,16 +31,9 @@
static_assert(!std::ranges::__nothrow_forward_iterator<ForwardProxyIterator>);
constexpr bool forward_subsumes_input(std::ranges::__nothrow_forward_iterator auto)
- requires true {
+ requires true {
return true;
}
constexpr bool forward_subsumes_input(std::ranges::__nothrow_input_iterator auto);
-constexpr bool input_subsumes_forward(std::ranges::__nothrow_input_iterator auto)
- requires true {
- return true;
-}
-constexpr bool input_subsumes_forward(std::ranges::__nothrow_forward_iterator auto);
-
static_assert(forward_subsumes_input("foo"));
-static_assert(!input_subsumes_forward("foo"));
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D115422.393019.patch
Type: text/x-patch
Size: 2203 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20211209/b978eb62/attachment-0001.bin>
More information about the libcxx-commits
mailing list