ACTS
Experiment-independent tracking
Loading...
Searching...
No Matches
detray::ranges::cartesian_product_view< range_ts > Struct Template Reference

Range adaptor that generates a cartesian product from the given input ranges. More...

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

Inheritance diagram for detray::ranges::cartesian_product_view< range_ts >:
[legend]
Collaboration diagram for detray::ranges::cartesian_product_view< range_ts >:
[legend]

Public Types

using iterator_coll_t = dtuple<detray::ranges::iterator_t<range_ts>...>
 Tuple of the begin or end iterator for each input range.
using iterator_t
 Iterator that advances through the Cartesian product.
using value_type
 Tuple of references to the current element of each input range.

Public Member Functions

constexpr cartesian_product_view ()=default
 Default constructor.
template<detray::ranges::range... deduced_range_ts>
requires ((sizeof...(deduced_range_ts) > 1) || ((!std::same_as<cartesian_product_view, deduced_range_ts>) && ...))
constexpr cartesian_product_view (deduced_range_ts... ranges)
 Construct from a pack of ranges.
constexpr auto begin () const -> iterator_t
constexpr auto data ()
constexpr auto data () const
constexpr auto end () const -> iterator_t
template<int I = static_cast<int>(sizeof...(range_ts)) - 1>
constexpr auto size (std::size_t s=1u) const noexcept -> std::size_t
Public Member Functions inherited from detray::ranges::view_interface< cartesian_product_view< range_ts... > >
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.

Detailed Description

template<detray::ranges::range... range_ts>
struct detray::ranges::cartesian_product_view< range_ts >

Range adaptor that generates a cartesian product from the given input ranges.

See also
https://en.cppreference.com/w/cpp/ranges/cartesian_product_view
https://github.com/gcc-mirror/gcc/blob/master/libstdc%2B%2B-v3/include/std/ranges

Member Typedef Documentation

◆ iterator_t

template<detray::ranges::range... range_ts>
using detray::ranges::cartesian_product_view< range_ts >::iterator_t
Initial value:
detray::ranges::iterator_t<range_ts>...>
Iterator implementation for the cartesian product view.
Definition cartesian_product.hpp:135

Iterator that advances through the Cartesian product.

◆ value_type

template<detray::ranges::range... range_ts>
using detray::ranges::cartesian_product_view< range_ts >::value_type
Initial value:
detray::tuple< types... > dtuple
Tuple type used by detray storage and dispatch.
Definition containers.hpp:46

Tuple of references to the current element of each input range.

Constructor & Destructor Documentation

◆ cartesian_product_view()

template<detray::ranges::range... range_ts>
template<detray::ranges::range... deduced_range_ts>
requires ((sizeof...(deduced_range_ts) > 1) || ((!std::same_as<cartesian_product_view, deduced_range_ts>) && ...))
detray::ranges::cartesian_product_view< range_ts >::cartesian_product_view ( deduced_range_ts... ranges)
explicitconstexpr

Construct from a pack of ranges.

Template Parameters
deduced_range_tsinput range types
Parameters
rangesinput ranges whose elements form the product

Member Function Documentation

◆ begin()

template<detray::ranges::range... range_ts>
auto detray::ranges::cartesian_product_view< range_ts >::begin ( ) const->iterator_t
constexpr
Returns
start position of range - const

◆ data() [1/2]

template<detray::ranges::range... range_ts>
auto detray::ranges::cartesian_product_view< range_ts >::data ( )
constexpr
Returns
a pointer to the beginning of the data of the first underlying range - non-const

◆ data() [2/2]

template<detray::ranges::range... range_ts>
auto detray::ranges::cartesian_product_view< range_ts >::data ( ) const
constexpr
Returns
a pointer to the beginning of the data of the first underlying range - const

◆ end()

template<detray::ranges::range... range_ts>
auto detray::ranges::cartesian_product_view< range_ts >::end ( ) const->iterator_t
constexpr
Returns
sentinel of the range - const

◆ size()

template<detray::ranges::range... range_ts>
template<int I = static_cast<int>(sizeof...(range_ts)) - 1>
auto detray::ranges::cartesian_product_view< range_ts >::size ( std::size_t s = 1u) const->std::size_t
constexprnoexcept
Returns
product of the number elements of all ranges in the view
Template Parameters
Iindex of the input range currently being counted
Parameters
sproduct accumulated from ranges already visited
Returns
product of the input range lengths