Arene Base
Fundamental Utilities For Safety Critical C++
Loading...
Searching...
No Matches
arene::base::constant_sequence_accessor< Sequence, ElementType > Class Template Reference

Accessor policy for mdspan which returns values from a compile time sequence. More...

Public Types

using data_handle_type = std::size_t
 The type of the data handle — this is the index into the sequence from which to start the accesses.
 
using element_type = ElementType
 The type of the element.
 
using offset_policy = constant_sequence_accessor
 The type of the accessor policy for accessing data with an offset — this is constant_sequence_accessor , since the value is constant.
 
using reference = ElementType
 The type of a "reference" to the element — this is the same as the element type, so no backing data is required, the value is returned by value.
 

Static Public Member Functions

static constexpr auto access (data_handle_type data_handle, std::size_t index) noexcept -> reference
 Return the value for the given data handle and index. The index is ignored as the value is always constant.
 
static constexpr auto offset (data_handle_type data_handle, std::size_t index) noexcept -> data_handle_type
 Return the data handle value to use with the offset policy for the given data handle and index.
 

Detailed Description

template<typename Sequence, typename ElementType = typename Sequence::value_type>
class arene::base::constant_sequence_accessor< Sequence, ElementType >

Accessor policy for mdspan which returns values from a compile time sequence.

Template Parameters
SequenceA type holding the sequence of values. This must either be:
  • an instance of a class template that has the element type as the first parameter and the elements themselves as subsequence parameters, and a member type alias value_type that is the type of the elements, as per std::integer_sequence , or
  • it must be a class type that has a member type alias value_type that is the type of the elements, a static member function size() for the size of the sequence that is callable in a constant expression, and a static member function values() that returns something convertible to an array of Sequence::size() elements of type Sequence::value_type that is callable in a constant expression
    Template Parameters
    ElementTypethe type of the element. The element type of Sequence must be convertible to the ElementType , which must be an object type that is not an abstract type.

Member Typedef Documentation

◆ data_handle_type

template<typename Sequence, typename ElementType = typename Sequence::value_type>
using arene::base::constant_sequence_accessor< Sequence, ElementType >::data_handle_type = std::size_t

The type of the data handle — this is the index into the sequence from which to start the accesses.

◆ element_type

template<typename Sequence, typename ElementType = typename Sequence::value_type>
using arene::base::constant_sequence_accessor< Sequence, ElementType >::element_type = ElementType

The type of the element.

◆ offset_policy

template<typename Sequence, typename ElementType = typename Sequence::value_type>
using arene::base::constant_sequence_accessor< Sequence, ElementType >::offset_policy = constant_sequence_accessor

The type of the accessor policy for accessing data with an offset — this is constant_sequence_accessor , since the value is constant.

◆ reference

template<typename Sequence, typename ElementType = typename Sequence::value_type>
using arene::base::constant_sequence_accessor< Sequence, ElementType >::reference = ElementType

The type of a "reference" to the element — this is the same as the element type, so no backing data is required, the value is returned by value.

Member Function Documentation

◆ access()

template<typename Sequence, typename ElementType = typename Sequence::value_type>
static constexpr auto arene::base::constant_sequence_accessor< Sequence, ElementType >::access ( data_handle_type data_handle,
std::size_t index ) -> reference
inlinestaticconstexprnoexcept

Return the value for the given data handle and index. The index is ignored as the value is always constant.

Parameters
data_handleThe base position into the sequence to use
indexThe index value to the chosen item from the base position
Returns
The fixed value from the sequence at the position (data_handle+index)
Precondition
The value of (data_handle+index) must be less than Sequence::size()

◆ offset()

template<typename Sequence, typename ElementType = typename Sequence::value_type>
static constexpr auto arene::base::constant_sequence_accessor< Sequence, ElementType >::offset ( data_handle_type data_handle,
std::size_t index ) -> data_handle_type
inlinestaticconstexprnoexcept

Return the data handle value to use with the offset policy for the given data handle and index.

Parameters
data_handleThe base position into the sequence to use
indexThe index value to the chosen item from the base position
Returns
(data_handle+index)

The documentation for this class was generated from the following file: