TuringSim
C++ framework to simulate abstract computing models
Static Public Member Functions | List of all members
TuringSim::Utils::ArrayBuilder< T, N > Class Template Reference

Build an array at compile time by applying a function. More...

#include <utils/arrayBuilder.h>

Static Public Member Functions

template<typename F >
constexpr static std::array< T, N > fromFunction (F f)
 Builds an array of size N by filling it with f(0), ..., f(N-1). More...
 

Detailed Description

template<typename T, size_t N>
class TuringSim::Utils::ArrayBuilder< T, N >

Build an array at compile time by applying a function.

Template Parameters
TThe type of elements in the resulting array.
NThe number size of the array.

Definition at line 16 of file arrayBuilder.h.

Member Function Documentation

◆ fromFunction()

template<typename T , size_t N>
template<typename F >
constexpr static std::array<T, N> TuringSim::Utils::ArrayBuilder< T, N >::fromFunction ( f)
inlinestaticconstexpr

Builds an array of size N by filling it with f(0), ..., f(N-1).

Template Parameters
Fthe type of the function to apply. It must be a unary function taking a size_t parameter and returning a T.
Parameters
[in]fthe function to apply.
Returns
the array [f(0), ..., f(N-1)].

Definition at line 31 of file arrayBuilder.h.


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