Arene Base
Fundamental Utilities For Safety Critical C++
Loading...
Searching...
No Matches
arene::base::extents< IndexType, Extents > Class Template Reference

represents a multidimensional index space More...

Inheritance diagram for arene::base::extents< IndexType, Extents >:
Inheritance graph

Public Types

using index_type = IndexType
 The specified index type for the extents.
 
using rank_type = typename extent_sequence_type::rank_type
 The type of the rank.
 
using size_type = std::make_unsigned_t<index_type>
 An unsigned type for representing an index into a dimension.
 

Public Member Functions

constexpr extents () noexcept
 Construct an extents object with all the dynamic extents set to zero, if any.
 
template<typename OtherIndexType, std::size_t N, constraints< std::enable_if_t< N==rank()>, std::enable_if_t< N !=rank_dynamic()>, std::enable_if_t< std::is_convertible< OtherIndexType, IndexType >::value >, std::enable_if_t< std::is_nothrow_constructible< IndexType, OtherIndexType >::value > > = nullptr>
constexpr extents (array< OtherIndexType, N > const &exts) noexcept
 Construct an extents object with the specified list of extents.
 
template<typename OtherIndexType, constraints< std::enable_if_t< std::is_convertible< OtherIndexType, IndexType >::value >, std::enable_if_t< std::is_nothrow_constructible< IndexType, OtherIndexType >::value > > = nullptr>
constexpr extents (array< OtherIndexType, rank_dynamic()> const &exts) noexcept
 Construct an extents object with the specified list of extents.
 
template<typename OtherIndexType, std::size_t... OtherExtents, constraints< std::enable_if_t< !copy_from_other_extents_is_explicit_v< OtherIndexType, mdspan_detail::extent_sequence< OtherExtents... > > >, std::enable_if_t< sizeof...(OtherExtents)==rank()>, std::enable_if_t<(Extents==OtherExtents)||(Extents==dynamic_extent)||(OtherExtents==dynamic_extent)>... > = nullptr>
constexpr extents (extents< OtherIndexType, OtherExtents... > const &source_extents) noexcept
 Construct an extents object with the same set of extents as the source extents object.
 
template<typename OtherIndexType, std::size_t... OtherExtents, constraints< std::enable_if_t< copy_from_other_extents_is_explicit_v< OtherIndexType, mdspan_detail::extent_sequence< OtherExtents... > > >, std::enable_if_t< sizeof...(OtherExtents)==rank()>, std::enable_if_t<(Extents==OtherExtents)||(Extents==dynamic_extent)||(OtherExtents==dynamic_extent)>... > = nullptr>
constexpr extents (extents< OtherIndexType, OtherExtents... > const &source_extents) noexcept
 Construct an extents object with the same set of extents as the source extents object.
 
template<typename... OtherIndexTypes, constraints< std::enable_if_t< sizeof...(OtherIndexTypes)==rank_dynamic()>, std::enable_if_t< all_of_v< std::is_convertible< OtherIndexTypes, IndexType >::value... > >, std::enable_if_t< all_of_v< std::is_nothrow_constructible< IndexType, OtherIndexTypes >::value... > > > = nullptr>
constexpr extents (OtherIndexTypes... exts) noexcept
 Construct an extents object with the specified list of dynamic extents.
 
template<typename... OtherIndexTypes, constraints< std::enable_if_t< sizeof...(OtherIndexTypes)==rank()>, std::enable_if_t< sizeof...(OtherIndexTypes) !=rank_dynamic()>, std::enable_if_t< all_of_v< std::is_convertible< OtherIndexTypes, IndexType >::value... > >, std::enable_if_t< all_of_v< std::is_nothrow_constructible< IndexType, OtherIndexTypes >::value... > > > = nullptr>
constexpr extents (OtherIndexTypes... exts) noexcept
 Construct an extents object with the specified list of extents.
 
template<typename OtherIndexType, std::size_t N, constraints< std::enable_if_t< N==rank()>, std::enable_if_t< N !=rank_dynamic()>, std::enable_if_t< std::is_convertible< OtherIndexType, IndexType >::value >, std::enable_if_t< std::is_nothrow_constructible< IndexType, OtherIndexType >::value > > = nullptr>
constexpr extents (span< OtherIndexType, N > exts) noexcept
 Construct an extents object with the specified list of extents.
 
template<typename OtherIndexType, constraints< std::enable_if_t< std::is_convertible< OtherIndexType, IndexType >::value >, std::enable_if_t< std::is_nothrow_constructible< IndexType, OtherIndexType >::value > > = nullptr>
constexpr extents (span< OtherIndexType, rank_dynamic()> exts) noexcept
 Construct an extents object with the specified list of extents.
 
constexpr auto extent (rank_type dimension) const noexcept -> index_type
 Get the actual extent for the given dimension, returning the extent supplied to the constructor for dynamic extents.
 

Friends

template<typename OtherIndexType, std::size_t... OtherExtents>
constexpr auto operator!= (extents const &lhs, extents< OtherIndexType, OtherExtents... > const &rhs) noexcept -> bool
 Compare two extents objects to see if they have different values.
 
template<typename OtherIndexType, std::size_t... OtherExtents, constraints< std::enable_if_t< rank() !=sizeof...(OtherExtents)> > = nullptr>
constexpr auto operator== (extents const &, extents< OtherIndexType, OtherExtents... > const &) noexcept -> bool
 Compare two extents objects with different ranks to see if they have the same values.
 
template<typename OtherIndexType, std::size_t... OtherExtents, constraints< std::enable_if_t< rank()==sizeof...(OtherExtents)> > = nullptr>
constexpr auto operator== (extents const &lhs, extents< OtherIndexType, OtherExtents... > const &rhs) noexcept -> bool
 Compare two extents objects with the same rank to see if they have the same values.
 

Detailed Description

template<typename IndexType, std::size_t... Extents>
class arene::base::extents< IndexType, Extents >

represents a multidimensional index space

Template Parameters
IndexTypethe index type
Extentsthe static extents of each dimension

Member Typedef Documentation

◆ index_type

template<typename IndexType, std::size_t... Extents>
using arene::base::extents< IndexType, Extents >::index_type = IndexType

The specified index type for the extents.

◆ rank_type

template<typename IndexType, std::size_t... Extents>
using arene::base::extents< IndexType, Extents >::rank_type = typename extent_sequence_type::rank_type

The type of the rank.

◆ size_type

template<typename IndexType, std::size_t... Extents>
using arene::base::extents< IndexType, Extents >::size_type = std::make_unsigned_t<index_type>

An unsigned type for representing an index into a dimension.

Constructor & Destructor Documentation

◆ extents() [1/9]

template<typename IndexType, std::size_t... Extents>
template<typename OtherIndexType, std::size_t N, constraints< std::enable_if_t< N==rank()>, std::enable_if_t< N !=rank_dynamic()>, std::enable_if_t< std::is_convertible< OtherIndexType, IndexType >::value >, std::enable_if_t< std::is_nothrow_constructible< IndexType, OtherIndexType >::value > > = nullptr>
arene::base::extents< IndexType, Extents >::extents ( span< OtherIndexType, N > exts)
inlineexplicitconstexprnoexcept

Construct an extents object with the specified list of extents.

Template Parameters
OtherIndexTypeThe type of the supplied extents
NThe number of supplied extents
Parameters
extsThe supplied extents
Precondition
OtherIndexType must be convertible to IndexType without throwing
Each of exts must be representable as a non-negative value of IndexType
The size of the span, N , must be equal to rank()
For each extent in Extents, if the corresponding value is not dynamic_extent, then the provided value, when converted to IndexType, must be the same as the specified value in Extents

◆ extents() [2/9]

template<typename IndexType, std::size_t... Extents>
template<typename OtherIndexType, constraints< std::enable_if_t< std::is_convertible< OtherIndexType, IndexType >::value >, std::enable_if_t< std::is_nothrow_constructible< IndexType, OtherIndexType >::value > > = nullptr>
arene::base::extents< IndexType, Extents >::extents ( span< OtherIndexType, rank_dynamic()> exts)
inlineconstexprnoexcept

Construct an extents object with the specified list of extents.

Template Parameters
OtherIndexTypeThe type of the supplied extents
Parameters
extsThe supplied extents
Precondition
OtherIndexType must be convertible to IndexType without throwing
The size of the span must be equal to rank() or dynamic_rank()
Each of exts must be representable as a non-negative value of IndexType

◆ extents() [3/9]

template<typename IndexType, std::size_t... Extents>
template<typename OtherIndexType, constraints< std::enable_if_t< std::is_convertible< OtherIndexType, IndexType >::value >, std::enable_if_t< std::is_nothrow_constructible< IndexType, OtherIndexType >::value > > = nullptr>
arene::base::extents< IndexType, Extents >::extents ( array< OtherIndexType, rank_dynamic()> const & exts)
inlineconstexprnoexcept

Construct an extents object with the specified list of extents.

Template Parameters
OtherIndexTypeThe type of the supplied extents
Parameters
extsThe supplied extents
Precondition
OtherIndexType must be convertible to IndexType without throwing
The size of the array must be equal to rank() or dynamic_rank()
Each of exts must be representable as a non-negative value of IndexType
For each extent in Extents, if the corresponding value is not dynamic_extent, then the provided value, when converted to IndexType, must be the same as the specified value in Extents

◆ extents() [4/9]

template<typename IndexType, std::size_t... Extents>
template<typename OtherIndexType, std::size_t N, constraints< std::enable_if_t< N==rank()>, std::enable_if_t< N !=rank_dynamic()>, std::enable_if_t< std::is_convertible< OtherIndexType, IndexType >::value >, std::enable_if_t< std::is_nothrow_constructible< IndexType, OtherIndexType >::value > > = nullptr>
arene::base::extents< IndexType, Extents >::extents ( array< OtherIndexType, N > const & exts)
inlineexplicitconstexprnoexcept

Construct an extents object with the specified list of extents.

Template Parameters
OtherIndexTypeThe type of the supplied extents
NThe number of supplied extents
Parameters
extsThe supplied extents
Precondition
OtherIndexType must be convertible to IndexType without throwing
The size of the array, N , must be equal to rank()
Each of exts must be representable as a non-negative value of IndexType
For each extent in Extents, if the corresponding value is not dynamic_extent, then the provided value, when converted to IndexType, must be the same as the specified value in Extents

◆ extents() [5/9]

template<typename IndexType, std::size_t... Extents>
template<typename... OtherIndexTypes, constraints< std::enable_if_t< sizeof...(OtherIndexTypes)==rank_dynamic()>, std::enable_if_t< all_of_v< std::is_convertible< OtherIndexTypes, IndexType >::value... > >, std::enable_if_t< all_of_v< std::is_nothrow_constructible< IndexType, OtherIndexTypes >::value... > > > = nullptr>
arene::base::extents< IndexType, Extents >::extents ( OtherIndexTypes... exts)
inlineexplicitconstexprnoexcept

Construct an extents object with the specified list of dynamic extents.

Template Parameters
OtherIndexTypesThe types of the supplied dynamic extents
Parameters
extsThe supplied dynamic extents
Precondition
Each of OtherIndexTypes must be convertible to IndexType without throwing
Each of exts must be representable as a non-negative value of IndexType

◆ extents() [6/9]

template<typename IndexType, std::size_t... Extents>
template<typename... OtherIndexTypes, constraints< std::enable_if_t< sizeof...(OtherIndexTypes)==rank()>, std::enable_if_t< sizeof...(OtherIndexTypes) !=rank_dynamic()>, std::enable_if_t< all_of_v< std::is_convertible< OtherIndexTypes, IndexType >::value... > >, std::enable_if_t< all_of_v< std::is_nothrow_constructible< IndexType, OtherIndexTypes >::value... > > > = nullptr>
arene::base::extents< IndexType, Extents >::extents ( OtherIndexTypes... exts)
inlineexplicitconstexprnoexcept

Construct an extents object with the specified list of extents.

Template Parameters
OtherIndexTypesThe types of the supplied extents
Parameters
extsThe supplied extents
Precondition
Each of OtherIndexTypes must be convertible to IndexType without throwing
Each of exts must be representable as a non-negative value of IndexType
For each extent in Extents, if the corresponding value is not dynamic_extent, then the provided value, when converted to IndexType, must be the same as the specified value in Extents

◆ extents() [7/9]

template<typename IndexType, std::size_t... Extents>
template<typename OtherIndexType, std::size_t... OtherExtents, constraints< std::enable_if_t< !copy_from_other_extents_is_explicit_v< OtherIndexType, mdspan_detail::extent_sequence< OtherExtents... > > >, std::enable_if_t< sizeof...(OtherExtents)==rank()>, std::enable_if_t<(Extents==OtherExtents)||(Extents==dynamic_extent)||(OtherExtents==dynamic_extent)>... > = nullptr>
arene::base::extents< IndexType, Extents >::extents ( extents< OtherIndexType, OtherExtents... > const & source_extents)
inlineconstexprnoexcept

Construct an extents object with the same set of extents as the source extents object.

Template Parameters
OtherIndexTypeThe index type of the supplied extents
OtherExtentsThe supplied extents
Parameters
source_extentsThe extents object to copy the extents from
Precondition
The other extents must match fixed extents, or be in range of IndexType for dynamic extents

◆ extents() [8/9]

template<typename IndexType, std::size_t... Extents>
template<typename OtherIndexType, std::size_t... OtherExtents, constraints< std::enable_if_t< copy_from_other_extents_is_explicit_v< OtherIndexType, mdspan_detail::extent_sequence< OtherExtents... > > >, std::enable_if_t< sizeof...(OtherExtents)==rank()>, std::enable_if_t<(Extents==OtherExtents)||(Extents==dynamic_extent)||(OtherExtents==dynamic_extent)>... > = nullptr>
arene::base::extents< IndexType, Extents >::extents ( extents< OtherIndexType, OtherExtents... > const & source_extents)
inlineexplicitconstexprnoexcept

Construct an extents object with the same set of extents as the source extents object.

Template Parameters
OtherIndexTypeThe index type of the supplied extents
OtherExtentsThe supplied extents
Parameters
source_extentsThe extents object to copy the extents from
Precondition
The other extents must match fixed extents, or be in range of IndexType for dynamic extents

◆ extents() [9/9]

template<typename IndexType, std::size_t... Extents>
arene::base::extents< IndexType, Extents >::extents ( )
inlineconstexprnoexcept

Construct an extents object with all the dynamic extents set to zero, if any.

Member Function Documentation

◆ extent()

template<typename IndexType, std::size_t... Extents>
auto arene::base::extents< IndexType, Extents >::extent ( rank_type dimension) const -> index_type
inlineconstexprnoexcept

Get the actual extent for the given dimension, returning the extent supplied to the constructor for dynamic extents.

Parameters
dimensionThe index of the dimension for which to get the extent
Returns
The extent of the specified dimension

Friends And Related Symbol Documentation

◆ operator!=

template<typename IndexType, std::size_t... Extents>
template<typename OtherIndexType, std::size_t... OtherExtents>
auto operator!= ( extents< IndexType, Extents > const & lhs,
extents< OtherIndexType, OtherExtents... > const & rhs ) -> bool
friend

Compare two extents objects to see if they have different values.

Template Parameters
OtherIndexTypeThe index type of the other extents type
OtherExtentsThe extents of the other extents type
Parameters
lhsThe first extents object to compare
rhsThe second extents object to compare
Returns
The inverse of lhs==rhs

◆ operator== [1/2]

template<typename IndexType, std::size_t... Extents>
template<typename OtherIndexType, std::size_t... OtherExtents, constraints< std::enable_if_t< rank() !=sizeof...(OtherExtents)> > = nullptr>
auto operator== ( extents< IndexType, Extents > const & ,
extents< OtherIndexType, OtherExtents... > const &  ) -> bool
friend

Compare two extents objects with different ranks to see if they have the same values.

Template Parameters
OtherIndexTypeThe index type of the other extents type
OtherExtentsThe extents of the other extents type
Returns
false.

◆ operator== [2/2]

template<typename IndexType, std::size_t... Extents>
template<typename OtherIndexType, std::size_t... OtherExtents, constraints< std::enable_if_t< rank()==sizeof...(OtherExtents)> > = nullptr>
auto operator== ( extents< IndexType, Extents > const & lhs,
extents< OtherIndexType, OtherExtents... > const & rhs ) -> bool
friend

Compare two extents objects with the same rank to see if they have the same values.

Template Parameters
OtherIndexTypeThe index type of the other extents type
OtherExtentsThe extents of the other extents type
Parameters
lhsThe first extents object to compare
rhsThe second extents object to compare
Returns
true if lhs.extent(index) is equal to rhs.extent(index) for all index values in [0,lhs.rank()) otherwise false.

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