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

Accessor policy for mdspan which always returns the same value. More...

Public Types

using data_handle_type = ElementType
 The type of the data handle — this is the same as the element type, so no backing data is required, the fixed value is passed in as the handle.
 
using element_type = ElementType
 The type of the element.
 
using offset_policy = constant_accessor
 The type of the accessor policy for accessing data with an offset — this is constant_accessor , since the value is constant, so the offset doesn't matter.
 
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) 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) noexcept -> reference
 Return the data handle value to use with the offset policy for the given data handle and index. The index is ignored as the value is always constant.
 

Detailed Description

template<typename ElementType>
class arene::base::constant_accessor< ElementType >

Accessor policy for mdspan which always returns the same value.

Template Parameters
ElementTypethe type of the element

Member Typedef Documentation

◆ data_handle_type

template<typename ElementType>
using arene::base::constant_accessor< ElementType >::data_handle_type = ElementType

The type of the data handle — this is the same as the element type, so no backing data is required, the fixed value is passed in as the handle.

◆ element_type

template<typename ElementType>
using arene::base::constant_accessor< ElementType >::element_type = ElementType

The type of the element.

◆ offset_policy

template<typename ElementType>
using arene::base::constant_accessor< ElementType >::offset_policy = constant_accessor

The type of the accessor policy for accessing data with an offset — this is constant_accessor , since the value is constant, so the offset doesn't matter.

◆ reference

template<typename ElementType>
using arene::base::constant_accessor< 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 ElementType>
static constexpr auto arene::base::constant_accessor< ElementType >::access ( data_handle_type data_handle,
std::size_t  ) -> 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 fixed value to return
Returns
The fixed value supplied as data_handle

◆ offset()

template<typename ElementType>
static constexpr auto arene::base::constant_accessor< ElementType >::offset ( data_handle_type data_handle,
std::size_t  ) -> reference
inlinestaticconstexprnoexcept

Return the data handle value to use with the offset policy for the given data handle and index. The index is ignored as the value is always constant.

Parameters
data_handleThe fixed value to return
Returns
The fixed value supplied as data_handle

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