36 template <
class Reference,
class Po
inter>
41 explicit proxy(
const Reference& x)
47 : m_reference(
std::move(x))
53 return std::addressof(m_reference);
58 Reference m_reference;
75 template <
class T,
class Po
inter>
82 return std::addressof(x);
93 template <
class Derived,
class IteratorConcept,
class Element,
class Reference,
class Difference>
101 static typename It::reference dereference(
const It& it)
103 return it.dereference();
107 static void increment(It& it)
113 static void decrement(It& it)
119 static void advance(It& it,
typename It::difference_type n)
125#if _WIN32 || __GNUC__ < 13
131 [[nodiscard]]
static typename It::difference_type
distance_to(
const It& lhs,
const It& rhs)
133 return lhs.distance_to(rhs);
137 [[nodiscard]]
static bool equal(
const It& lhs,
const It& rhs)
139 return lhs.equal(rhs);
143 [[nodiscard]]
static bool less_than(
const It& lhs,
const It& rhs)
145 return lhs.less_than(rhs);
149#if _WIN32 || __GNUC__ < 13
155 template <
class Derived,
class E,
class T,
class R,
class D>
159 friend typename It::difference_type
operator-(
const It&,
const It&);
169 template <
class Derived,
class Element,
class Reference,
class Difference>
178 using derived_type = Derived;
179 using value_type = std::remove_cv_t<Element>;
180 using reference = Reference;
181 using pointer =
typename operator_arrow_dispatcher::result_type;
182 using difference_type = Difference;
183 using iterator_category = std::forward_iterator_tag;
184 using iterator_concept = std::forward_iterator_tag;
186 reference operator*()
const
188 return iterator_access::dereference(this->derived());
191 pointer operator->()
const
193 return operator_arrow_dispatcher::apply(*this->derived());
196 derived_type& operator++()
198 iterator_access::increment(this->derived());
199 return this->derived();
202 derived_type operator++(
int)
204 derived_type tmp(this->derived());
209 friend inline bool operator==(
const derived_type& lhs,
const derived_type& rhs)
216 [[nodiscard]] derived_type& derived()
218 return *
static_cast<derived_type*
>(
this);
221 [[nodiscard]]
const derived_type& derived()
const
223 return *
static_cast<const derived_type*
>(
this);
228 template <
class Derived,
class Element,
class Reference,
class Difference>
229 class iterator_root_base<Derived, Element, std::bidirectional_iterator_tag, Reference, Difference>
230 :
public iterator_root_base<Derived, Element, std::forward_iterator_tag, Reference, Difference>
234 using base_type = iterator_root_base<Derived, Element, std::forward_iterator_tag, Reference, Difference>;
235 using derived_type =
typename base_type::derived_type;
236 using iterator_category = std::bidirectional_iterator_tag;
237 using iterator_concept = std::bidirectional_iterator_tag;
239 derived_type& operator--()
241 iterator_access::decrement(this->derived());
242 return this->derived();
245 derived_type operator--(
int)
247 derived_type tmp(this->derived());
254 template <
class Derived,
class Element,
class Reference,
class Difference>
256 :
public iterator_root_base<Derived, Element, std::bidirectional_iterator_tag, Reference, Difference>
269 iterator_access::advance(this->derived(), n);
270 return this->derived();
287 iterator_access::advance(this->derived(), -n);
288 return this->derived();
299 return iterator_access::dereference(this->derived() + n);
311 return std::strong_ordering::less;
315 return std::strong_ordering::equal;
319 return std::strong_ordering::greater;
325 template <
class Derived,
class Element,
class Reference,
class Difference>
327 :
public iterator_root_base<Derived, Element, std::random_access_iterator_tag, Reference, Difference>
334 using element_type =
typename base_type::value_type;
376 template <
class Derived,
class Element,
class IteratorConcept,
class Reference = Element&,
class Difference = std::ptrdiff_t>
394 class IteratorConcept =
typename std::iterator_traits<Iter>::iterator_category,
395 class Reference = std::iter_reference_t<Iter>,
396 class Difference = std::iter_difference_t<Iter>>
443 return rhs.p_iter - p_iter;
446 [[nodiscard]]
bool equal(
const self_type& rhs)
const
448 return p_iter == rhs.p_iter;
451 [[nodiscard]]
bool less_than(
const self_type& rhs)
const
453 return p_iter < rhs.p_iter;
479 using iterator_type =
typename base_type::iterator_type;
489 requires std::convertible_to<U*, iterator_type>
491 : base_type(iterator_type(u))
502 template <
class InputIt, std::
integral Distance>
503 [[nodiscard]]
constexpr InputIt
next(InputIt it, Distance n)
friend bool operator==(const It &, const It &)
friend It::difference_type operator-(const It &, const It &)
friend std::strong_ordering operator<=>(const It &, const It &)
static bool less_than(const It &lhs, const It &rhs)
friend class iterator_root_base
static It::difference_type distance_to(const It &lhs, const It &rhs)
static bool equal(const It &lhs, const It &rhs)
typename base_type::difference_type difference_type
iterator_adaptor< Derived, Iter, Element, IteratorConcept, Reference, Difference > self_type
iterator_adaptor(const iterator_type &iter)
friend class iterator_access
iterator_adaptor()=default
iterator_base< Derived, Element, IteratorConcept, Reference, Difference > base_type
typename base_type::reference reference
const iterator_type & base() const
std::contiguous_iterator_tag iterator_concept
friend derived_type operator-(const derived_type &it, difference_type n)
typename base_type::difference_type difference_type
typename base_type::reference reference
friend difference_type operator-(const derived_type &lhs, const derived_type &rhs)
friend derived_type operator+(difference_type n, const derived_type &it)
friend derived_type operator+(const derived_type &it, difference_type n)
reference operator[](difference_type n) const
typename base_type::derived_type derived_type
derived_type & operator-=(difference_type n)
std::random_access_iterator_tag iterator_concept
derived_type & operator+=(difference_type n)
std::random_access_iterator_tag iterator_category
friend std::strong_ordering operator<=>(const derived_type &lhs, const derived_type &rhs)
iterator_root_base< Derived, Element, std::bidirectional_iterator_tag, Reference, Difference > base_type
pointer_iterator< T * > make_pointer_iterator(T *t)
SPARROW_API bool operator==(const array &lhs, const array &rhs)
Compares the content of two arrays.
constexpr InputIt next(InputIt it, Distance n)
proxy(const Reference &x)
static result_type apply(T &x)
static result_type apply(Reference &&x)
static result_type apply(const Reference &x)