Template Class Triangle#

Class Documentation#

template<typename T, size_t dim>
class Triangle#

Triangular set storage.

Triangle stores sets who have a size equal to their their index + 1. The total storage of a Triangle instance is equal to the dim-th triangular number (starting with T_1 = 1). 0: Elem00 1: Elem10 Elem11 2: Elem20 Elem21 Elem22 …

Author

beyss

Date

23.08.2017

Public Functions

inline Triangle()#

Creates a Triangle with an empty storage.

inline Triangle(const std::vector<T> data)#

Creates a Triangle from a given data vector whose size must be the dim-th triangular number.

Parameters:

data – the data vector

inline virtual ~Triangle()#
inline const T &at(size_t i, size_t j) const#

Readonly access function for the j-th element of the i-th set.

Parameters:
  • i – the “row”

  • j – the “column”

Returns:

a constant reference to the storage element

inline T &at(size_t i, size_t j)#

Access function for the j-th element of the i-th set.

Parameters:
  • i – the “row”

  • j – the “column”

Returns:

a reference to the storage element