Arcane  4.1.12.0
User documentation
Loading...
Searching...
No Matches
Arcane::FixedArray< T, NbElement > Class Template Reference

Fixed-size 1D array. More...

#include <arccore/base/FixedArray.h>

Public Types

using value_type = T
using size_type = Int32
using difference_type = std::ptrdiff_t
using reference = value_type&
using const_reference = const value_type&
using pointer = value_type*
using const_pointer = const value_type*
using iterator = typename std::array<T, NbElement>::iterator
using const_iterator = typename std::array<T, NbElement>::const_iterator

Public Member Functions

constexpr FixedArray ()
 Creates an array by initializing elements with the default constructor of T.
constexpr FixedArray (std::array< T, NbElement > x)
 Creates an array by initializing elements with x.
constexpr FixedArray< T, NbElement > & operator= (std::array< T, NbElement > x)
 Copies x into the instance.
constexpr __host__ __device__ T & operator[] (Int32 index)
 Value of the i-th element.
constexpr __host__ __device__ const T & operator[] (Int32 index) const
 Value of the i-th element.
constexpr __host__ __device__ SmallSpan< T, NbElement > span ()
 Modifiable view of the array.
constexpr __host__ __device__ SmallSpan< const T, NbElement > span () const
 Non-modifiable view of the array.
constexpr __host__ __device__ ArrayView< T > view ()
 Modifiable view of the array.
constexpr __host__ __device__ ConstArrayView< T > view () const
 Non-modifiable view of the array.
constexpr __host__ __device__ const T * data () const
constexpr __host__ __device__ T * data ()
constexpr iterator begin ()
 Iterator to the beginning of the array.
constexpr iterator end ()
 Iterator to the end of the array.
constexpr const_iterator begin () const
 Constant iterator to the beginning of the array.
constexpr const_iterator end () const
 Constant iterator to the end of the array.

Static Public Member Functions

static constexpr Int32 size ()
 Number of elements in the array.

Detailed Description

template<typename T, Int32 NbElement>
class Arcane::FixedArray< T, NbElement >

Fixed-size 1D array.

This class is similar to std::array with the following differences:

  • the number of elements is an 'Int32'.
  • elements are initialized with the default constructor
  • in 'Check' mode, checks for array overflows

This class also provides conversions to ArrayView, ConstArrayView and SmallSpan.

Definition at line 45 of file arccore/src/base/arccore/base/FixedArray.h.

Member Typedef Documentation

◆ const_iterator

template<typename T, Int32 NbElement>
using Arcane::FixedArray< T, NbElement >::const_iterator = typename std::array<T, NbElement>::const_iterator

Definition at line 60 of file arccore/src/base/arccore/base/FixedArray.h.

◆ const_pointer

template<typename T, Int32 NbElement>
using Arcane::FixedArray< T, NbElement >::const_pointer = const value_type*

Definition at line 57 of file arccore/src/base/arccore/base/FixedArray.h.

◆ const_reference

template<typename T, Int32 NbElement>
using Arcane::FixedArray< T, NbElement >::const_reference = const value_type&

Definition at line 55 of file arccore/src/base/arccore/base/FixedArray.h.

◆ difference_type

template<typename T, Int32 NbElement>
using Arcane::FixedArray< T, NbElement >::difference_type = std::ptrdiff_t

Definition at line 53 of file arccore/src/base/arccore/base/FixedArray.h.

◆ iterator

template<typename T, Int32 NbElement>
using Arcane::FixedArray< T, NbElement >::iterator = typename std::array<T, NbElement>::iterator

Definition at line 59 of file arccore/src/base/arccore/base/FixedArray.h.

◆ pointer

template<typename T, Int32 NbElement>
using Arcane::FixedArray< T, NbElement >::pointer = value_type*

Definition at line 56 of file arccore/src/base/arccore/base/FixedArray.h.

◆ reference

template<typename T, Int32 NbElement>
using Arcane::FixedArray< T, NbElement >::reference = value_type&

Definition at line 54 of file arccore/src/base/arccore/base/FixedArray.h.

◆ size_type

template<typename T, Int32 NbElement>
using Arcane::FixedArray< T, NbElement >::size_type = Int32

Definition at line 52 of file arccore/src/base/arccore/base/FixedArray.h.

◆ value_type

template<typename T, Int32 NbElement>
using Arcane::FixedArray< T, NbElement >::value_type = T

Definition at line 51 of file arccore/src/base/arccore/base/FixedArray.h.

Constructor & Destructor Documentation

◆ FixedArray() [1/2]

template<typename T, Int32 NbElement>
Arcane::FixedArray< T, NbElement >::FixedArray ( )
inlineconstexpr

Creates an array by initializing elements with the default constructor of T.

Definition at line 65 of file arccore/src/base/arccore/base/FixedArray.h.

Referenced by operator=().

◆ FixedArray() [2/2]

template<typename T, Int32 NbElement>
Arcane::FixedArray< T, NbElement >::FixedArray ( std::array< T, NbElement > x)
inlineconstexpr

Creates an array by initializing elements with x.

Definition at line 69 of file arccore/src/base/arccore/base/FixedArray.h.

Member Function Documentation

◆ begin() [1/2]

template<typename T, Int32 NbElement>
iterator Arcane::FixedArray< T, NbElement >::begin ( )
inlineconstexpr

Iterator to the beginning of the array.

Definition at line 110 of file arccore/src/base/arccore/base/FixedArray.h.

◆ begin() [2/2]

template<typename T, Int32 NbElement>
const_iterator Arcane::FixedArray< T, NbElement >::begin ( ) const
inlineconstexpr

Constant iterator to the beginning of the array.

Definition at line 114 of file arccore/src/base/arccore/base/FixedArray.h.

◆ data() [1/2]

template<typename T, Int32 NbElement>
__host__ __device__ T * Arcane::FixedArray< T, NbElement >::data ( )
inlineconstexpr

Definition at line 102 of file arccore/src/base/arccore/base/FixedArray.h.

◆ data() [2/2]

template<typename T, Int32 NbElement>
__host__ __device__ const T * Arcane::FixedArray< T, NbElement >::data ( ) const
inlineconstexpr

Definition at line 101 of file arccore/src/base/arccore/base/FixedArray.h.

◆ end() [1/2]

template<typename T, Int32 NbElement>
iterator Arcane::FixedArray< T, NbElement >::end ( )
inlineconstexpr

Iterator to the end of the array.

Definition at line 112 of file arccore/src/base/arccore/base/FixedArray.h.

◆ end() [2/2]

template<typename T, Int32 NbElement>
const_iterator Arcane::FixedArray< T, NbElement >::end ( ) const
inlineconstexpr

Constant iterator to the end of the array.

Definition at line 116 of file arccore/src/base/arccore/base/FixedArray.h.

◆ operator=()

template<typename T, Int32 NbElement>
FixedArray< T, NbElement > & Arcane::FixedArray< T, NbElement >::operator= ( std::array< T, NbElement > x)
inlineconstexpr

Copies x into the instance.

Definition at line 73 of file arccore/src/base/arccore/base/FixedArray.h.

References FixedArray().

◆ operator[]() [1/2]

template<typename T, Int32 NbElement>
__host__ __device__ T & Arcane::FixedArray< T, NbElement >::operator[] ( Int32 index)
inlineconstexpr

Value of the i-th element.

Definition at line 82 of file arccore/src/base/arccore/base/FixedArray.h.

◆ operator[]() [2/2]

template<typename T, Int32 NbElement>
__host__ __device__ const T & Arcane::FixedArray< T, NbElement >::operator[] ( Int32 index) const
inlineconstexpr

Value of the i-th element.

Definition at line 88 of file arccore/src/base/arccore/base/FixedArray.h.

◆ size()

template<typename T, Int32 NbElement>
constexpr Int32 Arcane::FixedArray< T, NbElement >::size ( )
inlinestaticconstexpr

Number of elements in the array.

Definition at line 105 of file arccore/src/base/arccore/base/FixedArray.h.

◆ span() [1/2]

template<typename T, Int32 NbElement>
__host__ __device__ SmallSpan< T, NbElement > Arcane::FixedArray< T, NbElement >::span ( )
inlineconstexpr

Modifiable view of the array.

Definition at line 94 of file arccore/src/base/arccore/base/FixedArray.h.

◆ span() [2/2]

template<typename T, Int32 NbElement>
__host__ __device__ SmallSpan< const T, NbElement > Arcane::FixedArray< T, NbElement >::span ( ) const
inlineconstexpr

Non-modifiable view of the array.

Definition at line 96 of file arccore/src/base/arccore/base/FixedArray.h.

◆ view() [1/2]

template<typename T, Int32 NbElement>
__host__ __device__ ArrayView< T > Arcane::FixedArray< T, NbElement >::view ( )
inlineconstexpr

◆ view() [2/2]

template<typename T, Int32 NbElement>
__host__ __device__ ConstArrayView< T > Arcane::FixedArray< T, NbElement >::view ( ) const
inlineconstexpr

Non-modifiable view of the array.

Definition at line 100 of file arccore/src/base/arccore/base/FixedArray.h.


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