Sane C++ Libraries
C++ Platform Abstraction Libraries
SC::Reflection::ArrayWithSize< T, N > Struct Template Reference

A constexpr array. More...

#include <ReflectionFoundation.h>

Public Member Functions

 operator Span< const T > () const
 
constexpr bool contains (T value, uint32_t *outIndex=nullptr) const
 Check if array contains given value, and retrieve index where such item exists. More...
 
template<uint32_t N2>
constexpr bool append (const ArrayWithSize< T, N2 > &other)
 Appends another sized array to this one (assuming enough space) More...
 
constexpr bool push_back (const T &value)
 Append a single item to this array. More...
 
bool equals (Span< const T > other) const
 

Public Attributes

values [N] = {}
 
uint32_t size = 0
 

Detailed Description

template<typename T, uint32_t N>
struct SC::Reflection::ArrayWithSize< T, N >

A constexpr array.

Template Parameters
TItem types
NMaximum number of items

Member Function Documentation

◆ append()

template<typename T , uint32_t N>
template<uint32_t N2>
constexpr bool SC::Reflection::ArrayWithSize< T, N >::append ( const ArrayWithSize< T, N2 > &  other)
inlineconstexpr

Appends another sized array to this one (assuming enough space)

Template Parameters
N2Maximum size of other array
Parameters
otherThe array to append to this one
Returns
true if there was enough space to append the other array to this one

◆ contains()

template<typename T , uint32_t N>
constexpr bool SC::Reflection::ArrayWithSize< T, N >::contains ( value,
uint32_t outIndex = nullptr 
) const
inlineconstexpr

Check if array contains given value, and retrieve index where such item exists.

Parameters
valueValue to look for
outIndexif not nullptr will receive the index where item has been found
Returns
true if ArrayWithSize contains given value

◆ push_back()

template<typename T , uint32_t N>
constexpr bool SC::Reflection::ArrayWithSize< T, N >::push_back ( const T &  value)
inlineconstexpr

Append a single item to this array.

Parameters
valueValue to append
Returns
true if there was enough space for the value

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