[libcxx-commits] [PATCH] D84275: [Libcxx] Finish implementing Paper 0202R3
Nicholas Baron via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Jul 22 14:43:36 PDT 2020
Nicholas-Baron updated this revision to Diff 279947.
Nicholas-Baron added a comment.
Removed parts covered in https://reviews.llvm.org/D65721 and uncommented a test.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D84275/new/
https://reviews.llvm.org/D84275
Files:
libcxx/include/algorithm
libcxx/test/std/algorithms/alg.modifying.operations/alg.rotate/rotate_copy.pass.cpp
Index: libcxx/test/std/algorithms/alg.modifying.operations/alg.rotate/rotate_copy.pass.cpp
===================================================================
--- libcxx/test/std/algorithms/alg.modifying.operations/alg.rotate/rotate_copy.pass.cpp
+++ libcxx/test/std/algorithms/alg.modifying.operations/alg.rotate/rotate_copy.pass.cpp
@@ -18,21 +18,22 @@
#include "test_macros.h"
#include "test_iterators.h"
-// #if TEST_STD_VER > 17
-// TEST_CONSTEXPR bool test_constexpr() {
-// int ia[] = {1, 3, 5, 2, 5, 6};
-// int ib[std::size(ia)] = {0};
-//
-// const size_t N = 2;
-// const auto middle = std::begin(ia) + N;
-// auto it = std::rotate_copy(std::begin(ia), middle, std::end(ia), std::begin(ib));
-//
-// return std::distance(std::begin(ib), it) == std::size(ia)
-// && std::equal (std::begin(ia), middle, std::begin(ib) + std::size(ia) - N)
-// && std::equal (middle, std::end(ia), std::begin(ib))
-// ;
-// }
-// #endif
+#if TEST_STD_VER > 17
+TEST_CONSTEXPR bool test_constexpr() {
+ int ia[] = {1, 3, 5, 2, 5, 6};
+ int ib[std::size(ia)] = {0};
+
+ const size_t N = 2;
+ const auto middle = std::begin(ia) + N;
+ auto it =
+ std::rotate_copy(std::begin(ia), middle, std::end(ia), std::begin(ib));
+
+ return std::distance(std::begin(ib), it) == std::size(ia) &&
+ std::equal(std::begin(ia), middle,
+ std::begin(ib) + std::size(ia) - N) &&
+ std::equal(middle, std::end(ia), std::begin(ib));
+}
+#endif
template <class InIter, class OutIter>
void
@@ -148,9 +149,9 @@
test<const int*, random_access_iterator<int*> >();
test<const int*, int*>();
-// #if TEST_STD_VER > 17
-// static_assert(test_constexpr());
-// #endif
+#if TEST_STD_VER > 17
+ static_assert(test_constexpr());
+#endif
- return 0;
+ return 0;
}
Index: libcxx/include/algorithm
===================================================================
--- libcxx/include/algorithm
+++ libcxx/include/algorithm
@@ -2505,7 +2505,7 @@
// rotate_copy
template <class _ForwardIterator, class _OutputIterator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
_OutputIterator
rotate_copy(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last, _OutputIterator __result)
{
@@ -4393,7 +4393,7 @@
}
template <class _InputIterator1, class _InputIterator2, class _OutputIterator, class _Compare>
-inline _LIBCPP_INLINE_VISIBILITY
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
_OutputIterator
merge(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp)
@@ -4403,7 +4403,7 @@
}
template <class _InputIterator1, class _InputIterator2, class _OutputIterator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
_OutputIterator
merge(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D84275.279947.patch
Type: text/x-patch
Size: 3124 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20200722/8b1ee397/attachment.bin>
More information about the libcxx-commits
mailing list