ACTS
Experiment-independent tracking
Loading...
Searching...
No Matches
detray::ranges::detail::static_join_iterator< iterator_coll_t > Struct Template Reference

Sequentially iterate through multiple ranges of the same type. More...

#include <detray/utils/ranges/static_join.hpp>

Public Types

using difference_type = std::iter_difference_t<iterator_t>
 Distance type of the underlying iterators.
using iterator_category
 Iterator category supported by the underlying iterators.
using iterator_t = detray::detail::get_value_t<iterator_coll_t>
 Iterator type used within each input range.
using pointer = typename std::iterator_traits<iterator_t>::pointer
 Pointer type associated with the underlying iterator.
using reference = std::iter_reference_t<iterator_t>
 Reference type associated with the underlying iterator.
using value_type = std::iter_value_t<iterator_t>
 Element type yielded by dereferencing this iterator.

Public Member Functions

constexpr static_join_iterator ()=default
 Default constructor required by LegacyIterator trait.
constexpr static_join_iterator (const iterator_coll_t &begins, const iterator_coll_t &ends)
 Construct from a collection of begins and ends positions.
constexpr static_join_iterator (const iterator_coll_t &begins, const iterator_coll_t &ends, iterator_t current, const std::size_t i)
 Fully parametrized construction.
constexpr auto operator* () const -> decltype(auto)
constexpr auto operator+= (const difference_type j) -> static_join_iterator &
 Advance the joined iterator by j elements.
constexpr auto operator-- (int) -> static_join_iterator
 Retreat and return the iterator's previous position.
constexpr auto operator-= (const difference_type j) -> static_join_iterator &
 Retreat the joined iterator by j elements.
constexpr decltype(auto) operator[] (const difference_type i) const
 Return the element at an offset from this position.
constexpr auto operator++ () -> static_join_iterator &
 Increment current iterator and check for switch between ranges.
constexpr auto operator++ (int) -> static_join_iterator
 Advance and return the iterator's previous position.
constexpr auto operator-- () -> static_join_iterator &
 Decrement current iterator and check for switch between ranges.

Detailed Description

template<detray::ranges::range iterator_coll_t>
requires std::input_iterator<detray::detail::get_value_t<T>>
struct detray::ranges::detail::static_join_iterator< iterator_coll_t >

Sequentially iterate through multiple ranges of the same type.

Once the sentinel of one range is reached, set the current iterator to the next ranges 'begin' (or 'end' if decrementing)

Template Parameters
iterator_coll_ttype of iterator collection of ranges to be joined. Can contain const iterators.
Note
The iterator must not be typed on the current range index, so that begin and sentinel type are the same.

Member Typedef Documentation

◆ iterator_category

template<detray::ranges::range iterator_coll_t>
using detray::ranges::detail::static_join_iterator< iterator_coll_t >::iterator_category
Initial value:
typename std::iterator_traits<iterator_t>::iterator_category

Iterator category supported by the underlying iterators.

Constructor & Destructor Documentation

◆ static_join_iterator() [1/2]

template<detray::ranges::range iterator_coll_t>
detray::ranges::detail::static_join_iterator< iterator_coll_t >::static_join_iterator ( const iterator_coll_t & begins,
const iterator_coll_t & ends )
constexpr

Construct from a collection of begins and ends positions.

Parameters
beginsbegin iterators in joined order
endsend iterators in joined order

◆ static_join_iterator() [2/2]

template<detray::ranges::range iterator_coll_t>
detray::ranges::detail::static_join_iterator< iterator_coll_t >::static_join_iterator ( const iterator_coll_t & begins,
const iterator_coll_t & ends,
iterator_t current,
const std::size_t i )
constexpr

Fully parametrized construction.

Parameters
beginsbegin iterators in joined order
endsend iterators in joined order
currentcurrent iterator in the selected range
iindex of the selected range

Member Function Documentation

◆ operator*()

template<detray::ranges::range iterator_coll_t>
auto detray::ranges::detail::static_join_iterator< iterator_coll_t >::operator* ( ) const->decltype(auto)
constexpr
Returns
the single value that the iterator points to.

◆ operator++() [1/2]

template<detray::ranges::range iterator_coll_t>
auto detray::ranges::detail::static_join_iterator< iterator_coll_t >::operator++ ( ) ->static_join_iterator &
constexpr

Increment current iterator and check for switch between ranges.

Returns
A reference to this iterator after incrementing.

◆ operator++() [2/2]

template<detray::ranges::range iterator_coll_t>
auto detray::ranges::detail::static_join_iterator< iterator_coll_t >::operator++ ( int ) ->static_join_iterator
constexpr

Advance and return the iterator's previous position.

Returns
A copy of the iterator before incrementing.

◆ operator+=()

template<detray::ranges::range iterator_coll_t>
auto detray::ranges::detail::static_join_iterator< iterator_coll_t >::operator+= ( const difference_type j) ->static_join_iterator &
constexpr

Advance the joined iterator by j elements.

Parameters
jnumber of elements to advance
Returns
A reference to this iterator after advancing.

◆ operator--() [1/2]

template<detray::ranges::range iterator_coll_t>
auto detray::ranges::detail::static_join_iterator< iterator_coll_t >::operator-- ( ) ->static_join_iterator &
constexpr

Decrement current iterator and check for switch between ranges.

Returns
A reference to this iterator after decrementing.

◆ operator--() [2/2]

template<detray::ranges::range iterator_coll_t>
auto detray::ranges::detail::static_join_iterator< iterator_coll_t >::operator-- ( int ) ->static_join_iterator
constexpr

Retreat and return the iterator's previous position.

Returns
A copy of the iterator before decrementing.

◆ operator-=()

template<detray::ranges::range iterator_coll_t>
auto detray::ranges::detail::static_join_iterator< iterator_coll_t >::operator-= ( const difference_type j) ->static_join_iterator &
constexpr

Retreat the joined iterator by j elements.

Parameters
jnumber of elements to retreat
Returns
A reference to this iterator after retreating.

◆ operator[]()

template<detray::ranges::range iterator_coll_t>
decltype(auto) detray::ranges::detail::static_join_iterator< iterator_coll_t >::operator[] ( const difference_type i) const
constexpr

Return the element at an offset from this position.

Parameters
izero-based offset from this iterator
Returns
the value at a given position - const