Skip to content

Commit 3e75d83

Browse files
committed
Finalize move iterator to detail namespace
1 parent a3d9034 commit 3e75d83

File tree

3 files changed

+29
-19
lines changed

3 files changed

+29
-19
lines changed

include/Lz/detail/iterator.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ namespace lz {
1010

1111
namespace detail {
1212

13-
template<class T>
14-
using const_reference = detail::conditional<std::is_lvalue_reference<T>::value, const T&, detail::remove_cvref<T>>;
13+
template<class Derived, class Reference, class Pointer, class DifferenceType, class Cat, class S = Derived>
14+
struct iterator;
1515

1616
template<class Derived, class Reference, class Pointer, class DifferenceType, class S>
1717
struct iterator<Derived, Reference, Pointer, DifferenceType, std::forward_iterator_tag, S> {

include/Lz/detail/iterators/duplicates.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,9 @@ class duplicates_iterator<Iterable, BinaryPredicate, enable_if<is_ra<iter_t<Iter
112112

113113
template<class Iterable, class BinaryPredicate>
114114
class duplicates_iterator<Iterable, BinaryPredicate, enable_if<!is_ra<iter_t<Iterable>>::value>>
115-
: public lz::iterator<duplicates_iterator<Iterable, BinaryPredicate>, std::pair<ref_t<iter_t<Iterable>>, size_t>,
116-
fake_ptr_proxy<std::pair<ref_t<iter_t<Iterable>>, size_t>>, diff_type<iter_t<Iterable>>,
117-
std::bidirectional_iterator_tag, default_sentinel_t> {
115+
: public iterator<duplicates_iterator<Iterable, BinaryPredicate>, std::pair<ref_t<iter_t<Iterable>>, size_t>,
116+
fake_ptr_proxy<std::pair<ref_t<iter_t<Iterable>>, size_t>>, diff_type<iter_t<Iterable>>,
117+
std::bidirectional_iterator_tag, default_sentinel_t> {
118118

119119
using it = iter_t<Iterable>;
120120
using traits = std::iterator_traits<iter_t<Iterable>>;

include/Lz/detail/traits.hpp

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -45,48 +45,58 @@ struct default_sentinel_t {
4545
*/
4646
LZ_INLINE_VAR constexpr default_sentinel_t default_sentinel{};
4747

48-
template<class Derived, class Reference, class Pointer, class DifferenceType, class IterCat, class S = Derived>
48+
} // namespace lz
49+
50+
namespace lz {
51+
namespace detail {
52+
53+
template<class Derived, class Reference, class Pointer, class DifferenceType, class IterCat, class S>
4954
struct iterator;
5055

56+
}
57+
} // namespace lz
58+
59+
LZ_MODULE_EXPORT namespace lz{
60+
5161
template<class Derived, class Reference, class Pointer, class DifferenceType, class IterCat, class Sentinel>
5262
constexpr bool
53-
operator==(const Sentinel& sent, const iterator<Derived, Reference, Pointer, DifferenceType, IterCat, Sentinel>& it) {
63+
operator==(const Sentinel& sent, const detail::iterator<Derived, Reference, Pointer, DifferenceType, IterCat, Sentinel>& it) {
5464
return it == sent;
5565
}
5666

5767
template<class Derived, class Reference, class Pointer, class DifferenceType, class IterCat, class Sentinel>
58-
constexpr bool
59-
operator!=(const Sentinel& sent, const iterator<Derived, Reference, Pointer, DifferenceType, IterCat, Sentinel>& it) {
68+
constexpr bool operator!=(const Sentinel& sent,
69+
const detail::iterator<Derived, Reference, Pointer, DifferenceType, IterCat, Sentinel>& it) {
6070
return !(it == sent);
6171
}
6272

6373
template<class Derived, class Reference, class Pointer, class DifferenceType, class IterCat, class Sentinel>
64-
LZ_NODISCARD constexpr bool
65-
operator<(const Sentinel& sent, const iterator<Derived, Reference, Pointer, DifferenceType, IterCat, Sentinel>& it) {
74+
LZ_NODISCARD constexpr bool operator<(
75+
const Sentinel& sent, const detail::iterator<Derived, Reference, Pointer, DifferenceType, IterCat, Sentinel>& it) {
6676
return sent - it < 0;
6777
}
6878

6979
template<class Derived, class Reference, class Pointer, class DifferenceType, class IterCat, class Sentinel>
70-
LZ_NODISCARD constexpr bool
71-
operator>(const Sentinel& sent, const iterator<Derived, Reference, Pointer, DifferenceType, IterCat, Sentinel>& it) {
80+
LZ_NODISCARD constexpr bool operator>(
81+
const Sentinel& sent, const detail::iterator<Derived, Reference, Pointer, DifferenceType, IterCat, Sentinel>& it) {
7282
return it < sent;
7383
}
7484

7585
template<class Derived, class Reference, class Pointer, class DifferenceType, class IterCat, class Sentinel>
76-
LZ_NODISCARD constexpr bool
77-
operator<=(const Sentinel& sent, const iterator<Derived, Reference, Pointer, DifferenceType, IterCat, Sentinel>& it) {
86+
LZ_NODISCARD constexpr bool operator<=(
87+
const Sentinel& sent, const detail::iterator<Derived, Reference, Pointer, DifferenceType, IterCat, Sentinel>& it) {
7888
return !(it < sent);
7989
}
8090

8191
template<class Derived, class Reference, class Pointer, class DifferenceType, class IterCat, class Sentinel>
82-
LZ_NODISCARD constexpr bool
83-
operator>=(const Sentinel& sent, const iterator<Derived, Reference, Pointer, DifferenceType, IterCat, Sentinel>& it) {
92+
LZ_NODISCARD constexpr bool operator>=(
93+
const Sentinel& sent, const detail::iterator<Derived, Reference, Pointer, DifferenceType, IterCat, Sentinel>& it) {
8494
return !(sent < it);
8595
}
8696

8797
template<class Derived, class Reference, class Pointer, class DifferenceType, class IterCat, class Sentinel>
88-
LZ_NODISCARD constexpr typename Derived::difference_type
89-
operator-(const Sentinel& sent, const iterator<Derived, Reference, Pointer, DifferenceType, IterCat, Sentinel>& it) {
98+
LZ_NODISCARD constexpr typename Derived::difference_type operator-(
99+
const Sentinel& sent, const detail::iterator<Derived, Reference, Pointer, DifferenceType, IterCat, Sentinel>& it) {
90100
return -(it - sent);
91101
}
92102

0 commit comments

Comments
 (0)