My P3349R1 paper clarifies that we should be able to lower contiguous
iterators to pointers, without worrying about side effects of individual
increment or dereference operations.
libstdc++-v3/ChangeLog:
* include/bits/stl_algobase.h (__nothrow_contiguous_iterator):
Remove.
(__memcpyable_iterators): Simplify.
---
Testing x86_64-linux.
Also available for review at https://forge.sourceware.org/gcc/gcc-TEST/pulls/38
libstdc++-v3/include/bits/stl_algobase.h | 18 ++----------------
1 file changed, 2 insertions(+), 16 deletions(-)
diff --git a/libstdc++-v3/include/bits/stl_algobase.h
b/libstdc++-v3/include/bits/stl_algobase.h
index fc7cc89736a..a7f34e7b1ba 100644
--- a/libstdc++-v3/include/bits/stl_algobase.h
+++ b/libstdc++-v3/include/bits/stl_algobase.h
@@ -359,27 +359,13 @@ _GLIBCXX_END_NAMESPACE_CONTAINER
#endif // HOSTED
#if __cpp_lib_concepts
- // N.B. this is not the same as nothrow-forward-iterator, which doesn't
- // require noexcept operations, it just says it's undefined if they throw.
- // Here we require them to be actually noexcept.
- template<typename _Iter>
- concept __nothrow_contiguous_iterator
- = contiguous_iterator<_Iter> && requires (_Iter __i) {
- // If this operation can throw then the iterator could cause
- // the algorithm to exit early via an exception, in which case
- // we can't use memcpy.
- { *__i } noexcept;
- };
-
template<typename _OutIter, typename _InIter, typename _Sent = _InIter>
concept __memcpyable_iterators
- = __nothrow_contiguous_iterator<_OutIter>
- && __nothrow_contiguous_iterator<_InIter>
+ = contiguous_iterator<_OutIter> && contiguous_iterator<_InIter>
&& sized_sentinel_for<_Sent, _InIter>
- && requires (_OutIter __o, _InIter __i, _Sent __s) {
+ && requires (_OutIter __o, _InIter __i) {
requires !!__memcpyable<decltype(std::to_address(__o)),
decltype(std::to_address(__i))>::__value;
- { __i != __s } noexcept;
};
#endif
--
2.48.1