9 template <
class T,
class Allocator = std::allocator<T>>
11 :
public std::vector<T,Allocator>
13 using Super = std::vector<T,Allocator>;
17 using size_type =
typename Super::size_type;
18 using reference =
typename Super::reference;
19 using const_reference =
typename Super::const_reference;
23 template <
class Vector>
28 template <
class V = Vector, std::enable_if_t<not std::is_const_v<V>,
int> = 0>
31 return (*vector_)[row_*cols_ + col];
34 const_reference
operator[](size_type col)
const
36 return (*vector_)[row_*cols_ + col];
60 Super::assign(Super::size(), s);
70 void resize(size_type r, size_type c, value_type v = {})
72 Super::resize(r*c, v);
78 size_type
rows() const noexcept
84 size_type
cols() const noexcept
96 return AccessProxy<Super>{
static_cast<Super*
>(
this), row, cols_};
99 AccessProxy<Super const>
operator[](size_type row)
const
101 return AccessProxy<Super const>{
static_cast<Super const*
>(
this), row, cols_};
Dense matrix with row-wise storage in flat data vector.
Definition: FlatMatrix.hpp:12
FlatMatrix(size_type r, size_type c, value_type v={})
Definition: FlatMatrix.hpp:51
FlatMatrix()=default
Default constructor, creates an empty 0x0 matrix.
size_type cols() const noexcept
Return the number of columns of the matrix.
Definition: FlatMatrix.hpp:84
AccessProxy< Super > operator[](size_type row)
Definition: FlatMatrix.hpp:94
void resize(size_type r, size_type c, value_type v={})
Resizes the container to contain r x c elements.
Definition: FlatMatrix.hpp:70
FlatMatrix & operator=(value_type s)
Assign value s to all entries of the matrix.
Definition: FlatMatrix.hpp:58
size_type rows() const noexcept
Return the number of rows of the matrix.
Definition: FlatMatrix.hpp:78