ACTS
Experiment-independent tracking
Loading...
Searching...
No Matches
detray::ranges::static_join_view< I, range_itr_t > Struct Template Reference

Range adaptor that joins different ranges of the same type (static). More...

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

Inheritance diagram for detray::ranges::static_join_view< I, range_itr_t >:
[legend]
Collaboration diagram for detray::ranges::static_join_view< I, range_itr_t >:
[legend]

Public Types

using iterator_coll_t = darray<range_itr_t, I>
 Begin/end iterator array for the fixed set of input ranges.
using iterator_t
 Iterator that advances across the input ranges in order.
using value_t = std::iter_value_t<iterator_t>
 Element type yielded by the joined view.

Public Member Functions

constexpr static_join_view ()=default
 Default constructor.
template<detray::ranges::range... ranges_t>
constexpr static_join_view (const ranges_t &...ranges)
 Construct from a pack of ranges - const.
template<detray::ranges::range... ranges_t>
requires ((sizeof...(ranges_t) > 1) || ((!std::same_as<static_join_view, ranges_t>) && ...))
constexpr static_join_view (ranges_t &&...ranges)
 Construct from a pack of ranges.
constexpr auto begin () const -> iterator_t
constexpr auto data () -> value_t *
constexpr auto data () const -> const value_t *
constexpr auto end () const -> iterator_t
constexpr auto size () const noexcept -> std::size_t
Public Member Functions inherited from detray::ranges::view_interface< static_join_view< I, range_itr_t > >
constexpr decltype(auto) back () const
 Return a reference to the last element.
constexpr auto data () const
 Return a pointer to the first element, or null for an empty view.
constexpr auto empty () const -> bool
 Check whether the view contains no elements.
constexpr decltype(auto) front () const
 Return a reference to the first element.
constexpr operator bool () const
 Test whether the view contains at least one element.
constexpr decltype(auto) operator[] (const dindex i) const
 Subscript operator that takes detray dindex.
constexpr auto size () const
 Return the number of elements in the view.

Public Attributes

iterator_coll_t m_begins {}
 Start and end position of the subranges.
iterator_coll_t m_ends {}
 End iterators of the input ranges.

Detailed Description

template<std::size_t I, std::input_iterator range_itr_t>
struct detray::ranges::static_join_view< I, range_itr_t >

Range adaptor that joins different ranges of the same type (static).

See also
https://en.cppreference.com/w/cpp/ranges/join_view
Template Parameters
Ithe number of ranges in the join.
range_itr_tthe iterator type of the ranges.
Note
Static implementation: The number of ranges needs to be know at compile time
Does not take ownership of the ranges it operates on. Their lifetime needs to be guaranteed throughout iteration or between iterations with the same join instance.
Is not fit for lazy evaluation.
Todo
improve performance of e.g. operator+ and operator+=

Member Typedef Documentation

◆ iterator_t

template<std::size_t I, std::input_iterator range_itr_t>
using detray::ranges::static_join_view< I, range_itr_t >::iterator_t
Initial value:
Sequentially iterate through multiple ranges of the same type.
Definition static_join.hpp:162

Iterator that advances across the input ranges in order.

Constructor & Destructor Documentation

◆ static_join_view() [1/2]

template<std::size_t I, std::input_iterator range_itr_t>
template<detray::ranges::range... ranges_t>
requires ((sizeof...(ranges_t) > 1) || ((!std::same_as<static_join_view, ranges_t>) && ...))
detray::ranges::static_join_view< I, range_itr_t >::static_join_view ( ranges_t &&... ranges)
explicitconstexpr

Construct from a pack of ranges.

Template Parameters
ranges_ttypes of the input ranges
Parameters
rangesranges to join in sequence

◆ static_join_view() [2/2]

template<std::size_t I, std::input_iterator range_itr_t>
template<detray::ranges::range... ranges_t>
detray::ranges::static_join_view< I, range_itr_t >::static_join_view ( const ranges_t &... ranges)
explicitconstexpr

Construct from a pack of ranges - const.

Template Parameters
ranges_ttypes of the input ranges
Parameters
rangesranges to join in sequence

Member Function Documentation

◆ begin()

template<std::size_t I, std::input_iterator range_itr_t>
auto detray::ranges::static_join_view< I, range_itr_t >::begin ( ) const->iterator_t
constexpr
Returns
start position of range - const

◆ data() [1/2]

template<std::size_t I, std::input_iterator range_itr_t>
auto detray::ranges::static_join_view< I, range_itr_t >::data ( ) ->value_t *
constexpr
Returns
a pointer to the beginning of the data of the first underlying range - non-const

◆ data() [2/2]

template<std::size_t I, std::input_iterator range_itr_t>
auto detray::ranges::static_join_view< I, range_itr_t >::data ( ) const->constvalue_t *
constexpr
Returns
a pointer to the beginning of the data of the first underlying range - const

◆ end()

template<std::size_t I, std::input_iterator range_itr_t>
auto detray::ranges::static_join_view< I, range_itr_t >::end ( ) const->iterator_t
constexpr
Returns
sentinel of the range.

◆ size()

template<std::size_t I, std::input_iterator range_itr_t>
auto detray::ranges::static_join_view< I, range_itr_t >::size ( ) const->std::size_t
constexprnoexcept
Returns
sum of the number elements of all ranges in the join

Member Data Documentation

◆ m_begins

template<std::size_t I, std::input_iterator range_itr_t>
iterator_coll_t detray::ranges::static_join_view< I, range_itr_t >::m_begins {}

Start and end position of the subranges.

Begin iterators of the input ranges.