39 template <
class Reference,
class Po
inter>
44 explicit proxy(
const Reference& x) noexcept
49 explicit proxy(Reference&& x) noexcept
50 : m_reference(std::move(x))
56 return std::addressof(m_reference);
61 Reference m_reference;
78 template <
class T,
class Po
inter>
85 return std::addressof(x);
96 template <
class Derived,
class IteratorConcept,
class Element,
class Reference,
class Difference>
104 static typename It::reference dereference(
const It& it)
106 return it.dereference();
110 static void increment(It& it)
116 static void decrement(It& it)
122 static void advance(It& it,
typename It::difference_type n)
128#if _WIN32 || __GNUC__ < 13
134 [[nodiscard]]
static typename It::difference_type
distance_to(
const It& lhs,
const It& rhs)
136 return lhs.distance_to(rhs);
140 [[nodiscard]]
static bool equal(
const It& lhs,
const It& rhs)
142 return lhs.equal(rhs);
146 [[nodiscard]]
static bool less_than(
const It& lhs,
const It& rhs)
148 return lhs.less_than(rhs);
152#if _WIN32 || __GNUC__ < 13
158 template <
class Derived,
class E,
class T,
class R,
class D>
162 friend typename It::difference_type
operator-(
const It&,
const It&);
172 template <
class Derived,
class Element,
class Reference,
class Difference>
191 return iterator_access::dereference(this->
derived());
201 iterator_access::increment(this->
derived());
231 template <
class Derived,
class Element,
class Reference,
class Difference>
233 :
public iterator_root_base<Derived, Element, std::forward_iterator_tag, Reference, Difference>
244 iterator_access::decrement(this->
derived());
257 template <
class Derived,
class Element,
class Reference,
class Difference>
259 :
public iterator_root_base<Derived, Element, std::bidirectional_iterator_tag, Reference, Difference>
272 iterator_access::advance(this->
derived(), n);
290 iterator_access::advance(this->
derived(), -n);
302 return iterator_access::dereference(this->
derived() + n);
314 return std::strong_ordering::less;
318 return std::strong_ordering::equal;
322 return std::strong_ordering::greater;
328 template <
class Derived,
class Element,
class Reference,
class Difference>
330 :
public iterator_root_base<Derived, Element, std::random_access_iterator_tag, Reference, Difference>
379 template <
class Derived,
class Element,
class IteratorConcept,
class Reference = Element&,
class Difference = std::ptrdiff_t>
397 class IteratorConcept =
typename std::iterator_traits<Iter>::iterator_category,
398 class Reference = std::iter_reference_t<Iter>,
399 class Difference = std::iter_difference_t<Iter>>
429 constexpr void increment()
434 constexpr void decrement()
446 return rhs.p_iter - p_iter;
449 [[nodiscard]]
constexpr bool equal(
const self_type& rhs)
const
451 return p_iter == rhs.p_iter;
454 [[nodiscard]]
constexpr bool less_than(
const self_type& rhs)
const
456 return p_iter < rhs.p_iter;
492 requires std::convertible_to<U*, iterator_type>
534 class IndexType = std::size_t,
535 class Difference = std::ptrdiff_t>
537 :
public iterator_base<Derived, Element, IteratorTag, Reference, Difference>
571 if constexpr (std::is_signed_v<IndexType>)
573 m_index +=
static_cast<IndexType
>(n);
578 m_index =
static_cast<IndexType
>(
static_cast<Difference
>(
m_index) + n);
582 [[nodiscard]]
constexpr Difference
586 return static_cast<Difference
>(rhs.m_index) -
static_cast<Difference
>(
m_index);
589 [[nodiscard]]
constexpr bool equal(
const Derived& rhs)
const noexcept
594 [[nodiscard]]
constexpr bool
604 template <
class InputIt, std::
integral Distance>
605 [[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
constexpr iterator_adaptor(const iterator_type &iter)
constexpr const iterator_type & base() const
constexpr iterator_adaptor()=default
friend class iterator_access
iterator_base< Derived, Element, IteratorConcept, Reference, Difference > base_type
typename base_type::reference reference
std::bidirectional_iterator_tag iterator_category
iterator_root_base< Derived, Element, std::forward_iterator_tag, Reference, Difference > base_type
std::bidirectional_iterator_tag iterator_concept
derived_type & operator--()
derived_type operator--(int)
typename base_type::derived_type derived_type
std::contiguous_iterator_tag iterator_concept
std::forward_iterator_tag iterator_category
const derived_type & derived() const
derived_type operator++(int)
std::forward_iterator_tag iterator_concept
Difference difference_type
derived_type & operator++()
std::remove_cv_t< Element > value_type
reference operator*() const
friend bool operator==(const derived_type &lhs, const derived_type &rhs)
pointer operator->() const
typename operator_arrow_dispatcher::result_type pointer
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
constexpr void advance(Difference n) noexcept(SPARROW_CONTRACTS_THROW_ON_FAILURE==0)
constexpr pointer_index_iterator_base() noexcept=default
constexpr Difference distance_to(const Derived &rhs) const noexcept(SPARROW_CONTRACTS_THROW_ON_FAILURE==0)
constexpr void increment() noexcept(SPARROW_CONTRACTS_THROW_ON_FAILURE==0)
std::ptrdiff_t difference_type
constexpr bool equal(const Derived &rhs) const noexcept
constexpr void decrement() noexcept(SPARROW_CONTRACTS_THROW_ON_FAILURE==0)
constexpr bool less_than(const Derived &rhs) const noexcept(SPARROW_CONTRACTS_THROW_ON_FAILURE==0)
friend class iterator_access
constexpr pointer_iterator(iterator_type p)
constexpr pointer_iterator(U *u)
constexpr pointer_iterator()=default
iterator_adaptor< self_type, T *, T, std::contiguous_iterator_tag > base_type
pointer_iterator< T * > self_type
typename base_type::iterator_type iterator_type
#define SPARROW_ASSERT_TRUE(expr__)
#define SPARROW_CONTRACTS_THROW_ON_FAILURE
constexpr pointer_iterator< T * > make_pointer_iterator(T *t)
constexpr InputIt next(InputIt it, Distance n)
Extensions to the C++ standard library.
proxy(const Reference &x) noexcept
Reference * operator->() noexcept
proxy(Reference &&x) noexcept
static result_type apply(T &x)
static result_type apply(Reference &&x)
static result_type apply(const Reference &x)