Skip to content

Commit a9f11cc

Browse files
committed
Revert "[libcxx][iterator] adds std::indirectly_readable and std::indirectly_writable"
This reverts commit 0473318 which was failing for multiple people.
1 parent 71e8038 commit a9f11cc

File tree

41 files changed

+13
-1151
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+13
-1151
lines changed

libcxx/include/__iterator/concepts.h

Lines changed: 10 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@
1212

1313
#include <__config>
1414
#include <concepts>
15-
#include <__iterator/iter_move.h>
16-
#include <__iterator/incrementable_traits.h>
17-
#include <__iterator/iterator_traits.h>
18-
#include <__iterator/readable_traits.h>
1915

2016
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
2117
#pragma GCC system_header
@@ -28,36 +24,18 @@ _LIBCPP_BEGIN_NAMESPACE_STD
2824

2925
#if !defined(_LIBCPP_HAS_NO_RANGES)
3026

31-
// clang-format off
27+
template<class _Tp>
28+
using __with_reference = _Tp&;
3229

33-
// [iterator.concept.readable]
34-
template<class _In>
35-
concept __indirectly_readable_impl =
36-
requires(const _In __in) {
37-
typename iter_value_t<_In>;
38-
typename iter_reference_t<_In>;
39-
typename iter_rvalue_reference_t<_In>;
40-
{ *__in } -> same_as<iter_reference_t<_In> >;
41-
{ ranges::iter_move(__in) } -> same_as<iter_rvalue_reference_t<_In> >;
42-
} &&
43-
common_reference_with<iter_reference_t<_In>&&, iter_value_t<_In>&> &&
44-
common_reference_with<iter_reference_t<_In>&&, iter_rvalue_reference_t<_In>&&> &&
45-
common_reference_with<iter_rvalue_reference_t<_In>&&, const iter_value_t<_In>&>;
30+
template<class _Tp>
31+
concept __referenceable = requires {
32+
typename __with_reference<_Tp>;
33+
};
4634

47-
template<class _In>
48-
concept indirectly_readable = __indirectly_readable_impl<remove_cvref_t<_In> >;
49-
50-
// [iterator.concept.writable]
51-
template<class _Out, class _Tp>
52-
concept indirectly_writable =
53-
requires(_Out&& __o, _Tp&& __t) {
54-
*__o = _VSTD::forward<_Tp>(__t); // not required to be equality-preserving
55-
*_VSTD::forward<_Out>(__o) = _VSTD::forward<_Tp>(__t); // not required to be equality-preserving
56-
const_cast<const iter_reference_t<_Out>&&>(*__o) = _VSTD::forward<_Tp>(__t); // not required to be equality-preserving
57-
const_cast<const iter_reference_t<_Out>&&>(*_VSTD::forward<_Out>(__o)) = _VSTD::forward<_Tp>(__t); // not required to be equality-preserving
58-
};
59-
60-
// clang-format on
35+
template<class _Tp>
36+
concept __dereferenceable = requires(_Tp& __t) {
37+
{ *__t } -> __referenceable; // not required to be equality-preserving
38+
};
6139

6240
#endif // !defined(_LIBCPP_HAS_NO_RANGES)
6341

libcxx/include/__iterator/incrementable_traits.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#define _LIBCPP___ITERATOR_INCREMENTABLE_TRAITS_H
1212

1313
#include <__config>
14-
#include <concepts>
14+
#include <__iterator/concepts.h>
1515
#include <type_traits>
1616

1717
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)

libcxx/include/__iterator/iter_move.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#define _LIBCPP___ITERATOR_ITER_MOVE_H
1212

1313
#include <__config>
14-
#include <__iterator/iterator_traits.h>
14+
#include <__iterator/concepts.h>
1515
#include <concepts> // __class_or_enum
1616
#include <type_traits>
1717
#include <utility>

libcxx/include/__iterator/iterator_traits.h

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,23 +27,9 @@ _LIBCPP_BEGIN_NAMESPACE_STD
2727

2828
#if !defined(_LIBCPP_HAS_NO_RANGES)
2929

30-
template <class _Tp>
31-
using __with_reference = _Tp&;
32-
33-
template <class _Tp>
34-
concept __referenceable = requires {
35-
typename __with_reference<_Tp>;
36-
};
37-
38-
template <class _Tp>
39-
concept __dereferenceable = requires(_Tp& __t) {
40-
{ *__t } -> __referenceable; // not required to be equality-preserving
41-
};
42-
4330
// [iterator.traits]
4431
template<__dereferenceable _Tp>
4532
using iter_reference_t = decltype(*declval<_Tp&>());
46-
4733
#endif // !defined(_LIBCPP_HAS_NO_RANGES)
4834

4935
template <class _Iter>

libcxx/include/__iterator/readable_traits.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
#define _LIBCPP___ITERATOR_READABLE_TRAITS_H
1212

1313
#include <__config>
14-
#include <concepts>
15-
#include <type_traits>
14+
#include <__iterator/concepts.h>
1615

1716
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
1817
#pragma GCC system_header

libcxx/include/iterator

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,6 @@ template<dereferenceable T>
4343
requires ...
4444
using iter_rvalue_reference_t = decltype(ranges::iter_move(declval<T&>())); // since C++20
4545
46-
// [iterator.concepts], iterator concepts
47-
// [iterator.concept.readable], concept indirectly_­readable
48-
template<class In>
49-
concept indirectly_readable = see below; // since C++20
50-
51-
// [iterator.concept.writable], concept indirectly_­writable
52-
template<class Out, class T>
53-
concept indirectly_writable = see below; // since C++20
54-
5546
template<class Category, class T, class Distance = ptrdiff_t,
5647
class Pointer = T*, class Reference = T&>
5748
struct iterator

libcxx/test/std/containers/associative/map/iterator_concept_conformance.compile.pass.cpp

Lines changed: 0 additions & 27 deletions
This file was deleted.

libcxx/test/std/containers/associative/multimap/iterator_concept_conformance.compile.pass.cpp

Lines changed: 0 additions & 27 deletions
This file was deleted.

libcxx/test/std/containers/associative/multiset/iterator_concept_conformance.compile.pass.cpp

Lines changed: 0 additions & 27 deletions
This file was deleted.

libcxx/test/std/containers/associative/set/iterator_concept_conformance.compile.pass.cpp

Lines changed: 0 additions & 27 deletions
This file was deleted.

libcxx/test/std/containers/sequences/array/iterator_concept_conformance.compile.pass.cpp

Lines changed: 0 additions & 26 deletions
This file was deleted.

libcxx/test/std/containers/sequences/deque/iterator_concept_conformance.compile.pass.cpp

Lines changed: 0 additions & 27 deletions
This file was deleted.

libcxx/test/std/containers/sequences/forwardlist/forwardlist.iter/iterator_concept_conformance.compile.pass.cpp

Lines changed: 0 additions & 27 deletions
This file was deleted.

libcxx/test/std/containers/sequences/list/iterator_concept_conformance.compile.pass.cpp

Lines changed: 0 additions & 27 deletions
This file was deleted.

libcxx/test/std/containers/sequences/vector.bool/iterator_concept_conformance.compile.pass.cpp

Lines changed: 0 additions & 27 deletions
This file was deleted.

0 commit comments

Comments
 (0)