libtcod
Loading...
Searching...
No Matches
tcod::Matrix< T, Dimensions, Container > Class Template Reference

A template container for holding a multi-dimensional array of items. More...

#include <matrix.hpp>

Public Types

using size_type = int
using shape_type = std::array<size_type, Dimensions>
using index_type = std::array<size_type, Dimensions>
using reference = typename Container::reference
using const_reference = typename Container::const_reference

Public Member Functions

constexpr Matrix ()=default
 Default constructor.
constexpr Matrix (const shape_type &shape)
 Create a matrix of the given shape.
constexpr Matrix (const shape_type &shape, const T &fill_value)
 Create a matrix of the given shape filled with a default value.
constexpr auto begin () noexcept
 Return the iterator beginning.
constexpr auto begin () const noexcept
 Return the iterator beginning.
constexpr auto end () noexcept
 Return the iterator end.
constexpr auto end () const noexcept
 Return the iterator end.
constexpr reference operator[] (const index_type &index) noexcept
 Get the item at index.
constexpr const_reference operator[] (const index_type &index) const noexcept
 Get the const item at index.
constexpr reference at (const index_type &index)
 Get the item at index, checking bounds.
constexpr const_reference at (const index_type &index) const
 Get the const item at index, checking bounds.
constexpr const shape_type & get_shape () const noexcept
 Return the shape of this matrix.
constexpr bool in_bounds (const index_type &index) const noexcept
 Return true if index is within the bounds of this matrix.
constexpr operator MatrixView< T, Dimensions > () noexcept
 Implicit cast to a view of this matrix.
constexpr operator MatrixView< const T, Dimensions > () const noexcept
 Implicit cast to a const view of this matrix.
constexpr Container & get_container () noexcept
 Get the flat container for this matrix.
constexpr const Container & get_container () const noexcept
 Get the const flat container for this matrix.
template<class Archive>
void serialize (Archive &archive)

Detailed Description

template<typename T, size_t Dimensions, typename Container = std::vector<T>>
class tcod::Matrix< T, Dimensions, Container >

A template container for holding a multi-dimensional array of items.

Template Parameters
TThe type of value contained by this matrix.
DimensionsThe number of dimensions of this matrix type.
ContainerThe std::vector-like container used for this matrix.

This class is a work-in-progress.


The documentation for this class was generated from the following file:
  • C:/Users/4b796/Projects/libtcod/src/libtcod/matrix.hpp