13 #ifndef _DYNAMIC_ARRAY_
14 #define _DYNAMIC_ARRAY_
20 #include "ConFM/base.h"
42 for (
int i = 0; i < rows; ++i)
44 data.push_back(std::vector<T> (columns));
54 const std::vector<T> & operator [](
int i)
const {
65 typename std::vector<T>::reference
operator ()(
int i,
int j) {
76 typename std::vector<T>::const_reference
operator() (
int i,
int j)
const {
87 typename std::vector<T>::reference
at(
int i,
int j){
88 return checkIndices(this->data, i, j);
98 typename std::vector<T>::const_reference
at(
int i,
int j)
const {
99 return checkIndices(this->data, i, j);
109 for (
int i = 0; i < rows; ++i)
127 return data[0].size();
137 std::vector<std::vector<T>> data;
141 static auto checkIndices(C& vec,
int i,
int j) -> decltype(vec[i][j]) {
143 auto& row = vec.at(i);
147 std::throw_with_nested(std::out_of_range(
"While accessing column" + std::to_string(j)));
149 }
catch(
const std::nested_exception&) {
152 std::throw_with_nested(std::out_of_range(
"While accessing row" + std::to_string(i)));
170 for (
int i = 0; i < x.
getRows(); i++){
172 if (x(i,j) != y(i,j))
184 #endif // _DYNAMIC_ARRAY_