I am new to C++ and in the process of learning. I have a matrix deftype:
using Matrix = std::array<std::array<T, COL>, ROW>;
I can initialize a constexpr matrix "manually" as such
constexpr Matrix<int, 2,2> mat{ {
{{ 1,2 }},
{{ 3, 4 } }
}};
This is not feasible for large examples of ROW,COL. Instead i would like to initialize it "programmatically"(i.e. through a loop or similar) with a function fill_entry so that
mat[i][j] takes value fill_entry(i,j) and fill_entry is something like
template<T>
constexpr T fill_entry(T This_object_has_type_T,int i , int j).
What is a correct way to do this? I use C++17