vecmem 1.14.0
Loading...
Searching...
No Matches
Public Member Functions | List of all members
vecmem::array< T, N > Class Template Reference

Array with a fixed size, chosen during runtime. More...

#include <vecmem/containers/array.hpp>

Public Types

Type definitions, mimicking @c std::array
typedef T value_type
 Type of the array elements.
 
typedef std::size_t size_type
 Size type for the array.
 
typedef std::ptrdiff_t difference_type
 Pointer difference type.
 
typedef value_typereference
 Value reference type.
 
typedef const value_typeconst_reference
 Constant value reference type.
 
typedef value_typepointer
 Value pointer type.
 
typedef const value_typeconst_pointer
 Constant value pointer type.
 
typedef pointer iterator
 Forward iterator type.
 
typedef const_pointer const_iterator
 Constant forward iterator type.
 
typedef vecmem::details::reverse_iterator< iteratorreverse_iterator
 Reverse iterator type.
 
typedef vecmem::details::reverse_iterator< const_iteratorconst_reverse_iterator
 Constant reverse iterator type.
 

Public Member Functions

 array (memory_resource &resource)
 Make sure that the template type is default constructible.
 
 array (memory_resource &resource, size_type size)
 Constructor with a size and a memory resource to use.
 
 ~array ()=default
 Destructor.
 
Element accessor functions/operators
reference at (size_type pos)
 Access one element of the array (non-const)
 
const_reference at (size_type pos) const
 Access one element of the array (const)
 
reference operator[] (size_type pos)
 Access one element in the array (non-const)
 
const_reference operator[] (size_type pos) const
 Access one element in the array (const)
 
reference front ()
 Access the first element in the array (non-const)
 
const_reference front () const
 Access the first element in the array (const)
 
reference back ()
 Access the last element of the array (non-const)
 
const_reference back () const
 Access the last element of the array (const)
 
pointer data ()
 Access a pointer to the underlying memory block (non-const)
 
const_pointer data () const
 Access a pointer to the underlying memory block (const)
 
Iterator functions
iterator begin ()
 Get an iterator to the first element of the array (non-const)
 
const_iterator begin () const
 Get an iterator to the first element of the array (const)
 
const_iterator cbegin () const
 Get an iterator to the first element of the array (const)
 
iterator end ()
 Get an iterator to the element following the last element of the array (non-const)
 
const_iterator end () const
 Get an iterator to the element following the last element of the array (const)
 
const_iterator cend () const
 Get an iterator to the element following the last element of the array (const)
 
reverse_iterator rbegin ()
 Get a reverse iterator to the last element of the array (non-const)
 
const_reverse_iterator rbegin () const
 Get a reverse iterator to the last element of the array (const)
 
const_reverse_iterator crbegin () const
 Get a reverse iterator to the last element of the array (const)
 
reverse_iterator rend ()
 Get a reverse iterator to the element preceeding the first element of the array (non-const)
 
const_reverse_iterator rend () const
 Get a reverse iterator to the element preceeding the first element of the array (const)
 
const_reverse_iterator crend () const
 Get a reverse iterator to the element preceeding the first element of the array (const)
 
Capacity ckecker functions
bool empty () const noexcept
 Check whether the array has no elements.
 
size_type size () const noexcept
 Get the number of elements in the array.
 
Content manipulation functions
void fill (const_reference value)
 Assign the specified value to all elements of the array.
 

Detailed Description

template<typename T, std::size_t N = details::array_invalid_size>
class vecmem::array< T, N >

Array with a fixed size, chosen during runtime.

This class is similar to std::array in its interface, but fulfils a slightly different role. It wraps a fixed sized array just like std::array does, but it uses vecmem::memory_resource to manage that fixed sized array. As such, the size of the array can be decided at runtime, it does not need to be decided at compile time.

However, to be able to use it as a drop-in replacement for std::array, it does provide an optional second template argument, which can be used to set the fixed size of the array at compile time.

Constructor & Destructor Documentation

◆ array() [1/2]

template<typename T , std::size_t N>
vecmem::array< T, N >::array ( memory_resource &  resource)
explicit

Make sure that the template type is default constructible.

Constructor with a memory resource to use

Can only be used if the user chose a non-default value for the size template parameter.

◆ array() [2/2]

template<typename T , std::size_t N>
vecmem::array< T, N >::array ( memory_resource &  resource,
size_type  size 
)

Constructor with a size and a memory resource to use.

Can only be used if the user uses the default (invalid) value for the size template parameter.


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