NSUNI/NSLAR Library a250670
Loading...
Searching...
No Matches
Containers

Provides a few utility containers. More...

Classes

class  nnl::utl::Array3D< T >
 A 3-dimensional array template class. More...
class  nnl::utl::StaticSet< T, max_size >
 Fixed-size sorted set implementation. More...
class  nnl::utl::static_vector< T, Capacity >
 std::vector like class with a fixed-size inline storage (aka std::inplace_vector) More...

Detailed Description

Provides a few utility containers.


Class Documentation

◆ nnl::utl::Array3D

class nnl::utl::Array3D
template<typename T>
class nnl::utl::Array3D< T >

A 3-dimensional array template class.

Provides access to elements via 3D coordinates, utilizing a linear array under the hood for efficient storage.

Template Parameters
TThe type of elements stored in the array.
See also
nnl::collision::Collision
nnl::shadow_collision::Collision

Public Member Functions

 Array3D (std::size_t z, std::size_t y, std::size_t x)
 Constructs a 3D array with specified dimensions.
void Resize (std::size_t z, std::size_t y, std::size_t x)
 Resizes the 3D array to specified dimensions.
std::size_t SizeZ () const noexcept
 Returns the size of the array in the z dimension.
std::size_t SizeY () const noexcept
 Returns the size of the array in the y dimension.
std::size_t SizeX () const noexcept
 Returns the size of the array in the x dimension.
T & At (std::size_t z, std::size_t y, std::size_t x)
 Accesses an element at specified coordinates with bounds checking.
const T & At (std::size_t z, std::size_t y, std::size_t x) const
 Accesses an element at specified coordinates with bounds checking.
T & operator() (std::size_t z, std::size_t y, std::size_t x) noexcept
 Accesses an element at specified coordinates (no bounds checking).
const T & operator() (std::size_t z, std::size_t y, std::size_t x) const noexcept
 Accesses an element at specified coordinates (no bounds checking).

Constructor & Destructor Documentation

◆ Array3D()

template<typename T>
nnl::utl::Array3D< T >::Array3D ( std::size_t z,
std::size_t y,
std::size_t x )
inline

Constructs a 3D array with specified dimensions.

Parameters
zThe size in the z dimension.
yThe size in the y dimension.
xThe size in the x dimension.

Member Function Documentation

◆ At() [1/2]

template<typename T>
T & nnl::utl::Array3D< T >::At ( std::size_t z,
std::size_t y,
std::size_t x )
inline

Accesses an element at specified coordinates with bounds checking.

Parameters
zThe z coordinate of the element.
yThe y coordinate of the element.
xThe x coordinate of the element.
Returns
Reference to the specified element.

◆ At() [2/2]

template<typename T>
const T & nnl::utl::Array3D< T >::At ( std::size_t z,
std::size_t y,
std::size_t x ) const
inline

Accesses an element at specified coordinates with bounds checking.

Parameters
zThe z coordinate of the element.
yThe y coordinate of the element.
xThe x coordinate of the element.
Returns
Reference to the specified element.

◆ operator()() [1/2]

template<typename T>
const T & nnl::utl::Array3D< T >::operator() ( std::size_t z,
std::size_t y,
std::size_t x ) const
inlinenoexcept

Accesses an element at specified coordinates (no bounds checking).

Parameters
zThe z coordinate of the element.
yThe y coordinate of the element.
xThe x coordinate of the element.
Returns
Reference to the specified element.

◆ operator()() [2/2]

template<typename T>
T & nnl::utl::Array3D< T >::operator() ( std::size_t z,
std::size_t y,
std::size_t x )
inlinenoexcept

Accesses an element at specified coordinates (no bounds checking).

Parameters
zThe z coordinate of the element.
yThe y coordinate of the element.
xThe x coordinate of the element.
Returns
Reference to the specified element.

◆ Resize()

template<typename T>
void nnl::utl::Array3D< T >::Resize ( std::size_t z,
std::size_t y,
std::size_t x )
inline

Resizes the 3D array to specified dimensions.

Parameters
zThe new size in the z dimension.
yThe new size in the y dimension.
xThe new size in the x dimension.
Note
Existing data_ are not properly relocated by this method.

◆ SizeX()

template<typename T>
std::size_t nnl::utl::Array3D< T >::SizeX ( ) const
inlinenoexcept

Returns the size of the array in the x dimension.

Returns
The size in the x dimension.

◆ SizeY()

template<typename T>
std::size_t nnl::utl::Array3D< T >::SizeY ( ) const
inlinenoexcept

Returns the size of the array in the y dimension.

Returns
The size in the y dimension.

◆ SizeZ()

template<typename T>
std::size_t nnl::utl::Array3D< T >::SizeZ ( ) const
inlinenoexcept

Returns the size of the array in the z dimension.

Returns
The size in the z dimension.

◆ nnl::utl::StaticSet

class nnl::utl::StaticSet
template<typename T, std::size_t max_size>
class nnl::utl::StaticSet< T, max_size >

Fixed-size sorted set implementation.

Template Parameters
TArithmetic type for elements
max_sizeMaximum number of elements

◆ nnl::utl::static_vector

class nnl::utl::static_vector
template<typename T, std::size_t Capacity>
class nnl::utl::static_vector< T, Capacity >

std::vector like class with a fixed-size inline storage (aka std::inplace_vector)

Key differences include:

  • No allocator template parameter, as all allocations are inline.
  • Never reallocates, ensuring that iterators remain valid, unlike std::vector.