summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std/algorithms/alg.modifying.operations/alg.partitions
diff options
context:
space:
mode:
authorMarshall Clow <mclow.lists@gmail.com>2018-01-15 17:53:34 +0000
committerMarshall Clow <mclow.lists@gmail.com>2018-01-15 17:53:34 +0000
commit674f9128b7520ad43d3358724baf0f89baeeda02 (patch)
treea88aec995d8413689bc8df3df079760f9832a2d8 /libcxx/test/std/algorithms/alg.modifying.operations/alg.partitions
parent706ffef713a394b264ca1d4e8b8fa8d1aa38095b (diff)
downloadbcm5719-llvm-674f9128b7520ad43d3358724baf0f89baeeda02.tar.gz
bcm5719-llvm-674f9128b7520ad43d3358724baf0f89baeeda02.zip
partition_point gets the P0202 treatment
llvm-svn: 322493
Diffstat (limited to 'libcxx/test/std/algorithms/alg.modifying.operations/alg.partitions')
-rw-r--r--libcxx/test/std/algorithms/alg.modifying.operations/alg.partitions/partition_point.pass.cpp21
1 files changed, 19 insertions, 2 deletions
diff --git a/libcxx/test/std/algorithms/alg.modifying.operations/alg.partitions/partition_point.pass.cpp b/libcxx/test/std/algorithms/alg.modifying.operations/alg.partitions/partition_point.pass.cpp
index f5b832c6639..a08912bad57 100644
--- a/libcxx/test/std/algorithms/alg.modifying.operations/alg.partitions/partition_point.pass.cpp
+++ b/libcxx/test/std/algorithms/alg.modifying.operations/alg.partitions/partition_point.pass.cpp
@@ -10,19 +10,32 @@
// <algorithm>
// template<class ForwardIterator, class Predicate>
-// ForwardIterator
+// constpexr ForwardIterator // constexpr after C++17
// partition_point(ForwardIterator first, ForwardIterator last, Predicate pred);
#include <algorithm>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
struct is_odd
{
- bool operator()(const int& i) const {return i & 1;}
+ TEST_CONSTEXPR bool operator()(const int& i) const {return i & 1;}
};
+
+#if TEST_STD_VER > 17
+TEST_CONSTEXPR int test_constexpr() {
+ int ia[] = {1, 3, 5, 2, 4, 6};
+ int ib[] = {1, 2, 3, 4, 5, 6};
+ return (std::partition_point(std::begin(ia), std::end(ia), is_odd()) == ia+3)
+ && (std::partition_point(std::begin(ib), std::end(ib), is_odd()) == ib+1)
+ ;
+ }
+#endif
+
+
int main()
{
{
@@ -73,4 +86,8 @@ int main()
forward_iterator<const int*>(std::begin(ia)),
is_odd()) == forward_iterator<const int*>(ia));
}
+
+#if TEST_STD_VER > 17
+ static_assert(test_constexpr());
+#endif
}
OpenPOWER on IntegriCloud