matrix: use a more descriptive template param name

This commit is contained in:
Danny Robson 2018-03-13 22:34:48 +11:00
parent f09babd507
commit 44f8496256

View File

@ -36,13 +36,13 @@ namespace util {
template < template <
std::size_t Rows, std::size_t Rows,
std::size_t Cols, std::size_t Cols,
typename T typename ValueT
> >
struct matrix { struct matrix {
static constexpr auto rows = Rows; static constexpr auto rows = Rows;
static constexpr auto cols = Cols; static constexpr auto cols = Cols;
using row_t = util::vector<Cols,T>; using row_t = util::vector<Cols,ValueT>;
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
@ -50,10 +50,10 @@ namespace util {
//--------------------------------------------------------------------- //---------------------------------------------------------------------
constexpr matrix (const T(&_data)[Rows][Cols]) noexcept: constexpr matrix (const ValueT(&_data)[Rows][Cols]) noexcept:
values {} values {}
{ {
static_assert (sizeof (*this) == sizeof (T) * Rows * Cols); static_assert (sizeof (*this) == sizeof (ValueT) * Rows * Cols);
for (std::size_t r = 0; r < Rows; ++r) for (std::size_t r = 0; r < Rows; ++r)
for (std::size_t c = 0; c < Cols; ++c) for (std::size_t c = 0; c < Cols; ++c)
values[r][c] = _data[r][c]; values[r][c] = _data[r][c];
@ -62,7 +62,7 @@ namespace util {
//--------------------------------------------------------------------- //---------------------------------------------------------------------
template <std::size_t S, typename SelfT> template <std::size_t S, typename SelfT>
constexpr matrix (const util::coord::base<S,T,SelfT> (&_data)[Rows]) noexcept constexpr matrix (const util::coord::base<S,ValueT,SelfT> (&_data)[Rows]) noexcept
{ {
for (std::size_t r = 0; r < Rows; ++r) for (std::size_t r = 0; r < Rows; ++r)
for (std::size_t c = 0; c < Cols; ++c) for (std::size_t c = 0; c < Cols; ++c)
@ -135,7 +135,7 @@ namespace util {
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
T determinant (void) const; ValueT determinant (void) const;
matrix inverse (void) const; matrix inverse (void) const;