Sound Byte Libs 1ee2ca6
C++ firmware library for audio applications on 32-bit ARM Cortex-M processors
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
sbl::core::primitives::containers::Array< T, N > Class Template Reference

Fixed-size array container. More...

#include <fixed_array.hpp>

Collaboration diagram for sbl::core::primitives::containers::Array< T, N >:

Public Types

using value_type = T
 
using size_type = size_t
 
using reference = T &
 
using const_reference = const T &
 
using pointer = T *
 
using const_pointer = const T *
 
using iterator = T *
 
using const_iterator = const T *
 

Public Member Functions

 Array ()=default
 Default constructor.
 
 Array (const T &value)
 Fill constructor.
 
reference operator[] (size_type index)
 Access element at index.
 
const_reference operator[] (size_type index) const
 Access element at index (const)
 
reference at (size_type index)
 Access element with bounds checking.
 
const_reference at (size_type index) const
 Access element with bounds checking (const)
 
reference front ()
 Access first element.
 
const_reference front () const
 Access first element (const)
 
reference back ()
 Access last element.
 
const_reference back () const
 Access last element (const)
 
pointer data ()
 Get pointer to underlying array.
 
const_pointer data () const
 Get pointer to underlying array (const)
 
iterator begin ()
 Get iterator to beginning.
 
const_iterator begin () const
 Get iterator to beginning (const)
 
iterator end ()
 Get iterator to end.
 
const_iterator end () const
 Get iterator to end (const)
 
constexpr bool empty () const
 Check if array is empty.
 
constexpr size_type size () const
 Get array size.
 
constexpr size_type max_size () const
 Get maximum size.
 
void fill (const T &value)
 Fill array with value.
 
void swap (Array &other)
 Swap contents with another array.
 

Detailed Description

template<typename T, size_t N>
class sbl::core::primitives::containers::Array< T, N >

Fixed-size array container.

Lightweight array wrapper providing bounds-safe access and iteration support. All storage is allocated at compile time.

Template Parameters
TElement type
NArray size (must be greater than 0)

Definition at line 31 of file fixed_array.hpp.

Member Typedef Documentation

◆ const_iterator

template<typename T , size_t N>
using sbl::core::primitives::containers::Array< T, N >::const_iterator = const T*

Definition at line 42 of file fixed_array.hpp.

◆ const_pointer

template<typename T , size_t N>
using sbl::core::primitives::containers::Array< T, N >::const_pointer = const T*

Definition at line 40 of file fixed_array.hpp.

◆ const_reference

template<typename T , size_t N>
using sbl::core::primitives::containers::Array< T, N >::const_reference = const T&

Definition at line 38 of file fixed_array.hpp.

◆ iterator

template<typename T , size_t N>
using sbl::core::primitives::containers::Array< T, N >::iterator = T*

Definition at line 41 of file fixed_array.hpp.

◆ pointer

template<typename T , size_t N>
using sbl::core::primitives::containers::Array< T, N >::pointer = T*

Definition at line 39 of file fixed_array.hpp.

◆ reference

template<typename T , size_t N>
using sbl::core::primitives::containers::Array< T, N >::reference = T&

Definition at line 37 of file fixed_array.hpp.

◆ size_type

template<typename T , size_t N>
using sbl::core::primitives::containers::Array< T, N >::size_type = size_t

Definition at line 36 of file fixed_array.hpp.

◆ value_type

template<typename T , size_t N>
using sbl::core::primitives::containers::Array< T, N >::value_type = T

Definition at line 35 of file fixed_array.hpp.

Constructor & Destructor Documentation

◆ Array() [1/2]

template<typename T , size_t N>
sbl::core::primitives::containers::Array< T, N >::Array ( )
default

Default constructor.

Elements are default-initialized.

◆ Array() [2/2]

template<typename T , size_t N>
sbl::core::primitives::containers::Array< T, N >::Array ( const T &  value)
inlineexplicit

Fill constructor.

Parameters
valueValue to fill array with

Definition at line 56 of file fixed_array.hpp.

References sbl::core::primitives::containers::Array< T, N >::fill().

Here is the call graph for this function:

Member Function Documentation

◆ at() [1/2]

template<typename T , size_t N>
reference sbl::core::primitives::containers::Array< T, N >::at ( size_type  index)
inline

Access element with bounds checking.

Parameters
indexElement index
Returns
Reference to element
Note
Returns first element if index out of bounds

Definition at line 90 of file fixed_array.hpp.

◆ at() [2/2]

template<typename T , size_t N>
const_reference sbl::core::primitives::containers::Array< T, N >::at ( size_type  index) const
inline

Access element with bounds checking (const)

Parameters
indexElement index
Returns
Const reference to element

Definition at line 100 of file fixed_array.hpp.

◆ back() [1/2]

template<typename T , size_t N>
reference sbl::core::primitives::containers::Array< T, N >::back ( )
inline

Access last element.

Returns
Reference to last element

Definition at line 127 of file fixed_array.hpp.

◆ back() [2/2]

template<typename T , size_t N>
const_reference sbl::core::primitives::containers::Array< T, N >::back ( ) const
inline

Access last element (const)

Returns
Const reference to last element

Definition at line 136 of file fixed_array.hpp.

◆ begin() [1/2]

template<typename T , size_t N>
iterator sbl::core::primitives::containers::Array< T, N >::begin ( )
inline

Get iterator to beginning.

Returns
Iterator to first element

Definition at line 163 of file fixed_array.hpp.

◆ begin() [2/2]

template<typename T , size_t N>
const_iterator sbl::core::primitives::containers::Array< T, N >::begin ( ) const
inline

Get iterator to beginning (const)

Returns
Const iterator to first element

Definition at line 172 of file fixed_array.hpp.

◆ data() [1/2]

template<typename T , size_t N>
pointer sbl::core::primitives::containers::Array< T, N >::data ( )
inline

Get pointer to underlying array.

Returns
Pointer to first element

Definition at line 145 of file fixed_array.hpp.

◆ data() [2/2]

template<typename T , size_t N>
const_pointer sbl::core::primitives::containers::Array< T, N >::data ( ) const
inline

Get pointer to underlying array (const)

Returns
Const pointer to first element

Definition at line 154 of file fixed_array.hpp.

◆ empty()

template<typename T , size_t N>
constexpr bool sbl::core::primitives::containers::Array< T, N >::empty ( ) const
inlineconstexpr

Check if array is empty.

Returns
Always false (fixed-size array is never empty)

Definition at line 199 of file fixed_array.hpp.

◆ end() [1/2]

template<typename T , size_t N>
iterator sbl::core::primitives::containers::Array< T, N >::end ( )
inline

Get iterator to end.

Returns
Iterator past last element

Definition at line 181 of file fixed_array.hpp.

◆ end() [2/2]

template<typename T , size_t N>
const_iterator sbl::core::primitives::containers::Array< T, N >::end ( ) const
inline

Get iterator to end (const)

Returns
Const iterator past last element

Definition at line 190 of file fixed_array.hpp.

◆ fill()

template<typename T , size_t N>
void sbl::core::primitives::containers::Array< T, N >::fill ( const T &  value)
inline

Fill array with value.

Parameters
valueValue to fill with

Definition at line 226 of file fixed_array.hpp.

Referenced by sbl::core::primitives::containers::Array< T, N >::Array().

Here is the caller graph for this function:

◆ front() [1/2]

template<typename T , size_t N>
reference sbl::core::primitives::containers::Array< T, N >::front ( )
inline

Access first element.

Returns
Reference to first element

Definition at line 109 of file fixed_array.hpp.

◆ front() [2/2]

template<typename T , size_t N>
const_reference sbl::core::primitives::containers::Array< T, N >::front ( ) const
inline

Access first element (const)

Returns
Const reference to first element

Definition at line 118 of file fixed_array.hpp.

◆ max_size()

template<typename T , size_t N>
constexpr size_type sbl::core::primitives::containers::Array< T, N >::max_size ( ) const
inlineconstexpr

Get maximum size.

Returns
Maximum number of elements (same as size())

Definition at line 217 of file fixed_array.hpp.

◆ operator[]() [1/2]

template<typename T , size_t N>
reference sbl::core::primitives::containers::Array< T, N >::operator[] ( size_type  index)
inline

Access element at index.

Parameters
indexElement index
Returns
Reference to element
Note
No bounds checking in release builds for performance

Definition at line 68 of file fixed_array.hpp.

◆ operator[]() [2/2]

template<typename T , size_t N>
const_reference sbl::core::primitives::containers::Array< T, N >::operator[] ( size_type  index) const
inline

Access element at index (const)

Parameters
indexElement index
Returns
Const reference to element

Definition at line 78 of file fixed_array.hpp.

◆ size()

template<typename T , size_t N>
constexpr size_type sbl::core::primitives::containers::Array< T, N >::size ( ) const
inlineconstexpr

Get array size.

Returns
Number of elements (N)

Definition at line 208 of file fixed_array.hpp.

◆ swap()

template<typename T , size_t N>
void sbl::core::primitives::containers::Array< T, N >::swap ( Array< T, N > &  other)
inline

Swap contents with another array.

Parameters
otherArray to swap with

Definition at line 237 of file fixed_array.hpp.


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