summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Santmyer <jon@jonsantmyer.com>2022-11-18 10:12:04 -0500
committerJon Santmyer <jon@jonsantmyer.com>2022-11-18 10:12:04 -0500
commitfe32cd6b48e5d17ccfc60f6ea69d1345ae8dfa58 (patch)
treebc467eccded607745011c948c214c8d63892c197
parent3d57fbd094468cc2065f724dd3d0dcbb67cb8c85 (diff)
downloadcrmatrix-master.tar.gz
crmatrix-master.tar.bz2
crmatrix-master.zip
fix colmatrix, rowmatrix, sqmatrix private constructors. explicit inherited constructorsHEADmaster
-rw-r--r--matrix.hpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/matrix.hpp b/matrix.hpp
index ada303b..1e84db0 100644
--- a/matrix.hpp
+++ b/matrix.hpp
@@ -141,6 +141,18 @@ public:
template<typename T, std::size_t S>
class sqmatrix final : public matrix<T, S, S>
{
+public:
+ constexpr sqmatrix(const std::array<std::array<T, S>, S> &vs) :
+ matrix<T, S, S>(vs)
+ {}
+
+ constexpr sqmatrix(const std::array<T, S * S> &vs) :
+ matrix<T, S, S>(vs)
+ {}
+
+ constexpr sqmatrix(T a) :
+ matrix<T, S, S>(a) {}
+
static constexpr sqmatrix identity()
{
sqmatrix ret(0);
@@ -176,6 +188,14 @@ class sqmatrix final : public matrix<T, S, S>
template<typename T, std::size_t L>
class rowmatrix final : public matrix<T, L, 1>
{
+public:
+ constexpr rowmatrix(const std::array<T, L> &vs) :
+ matrix<T, L, 1>(vs)
+ {}
+
+ constexpr rowmatrix(T a) :
+ matrix<T, L, 1>(a) {}
+
constexpr T &operator[](std::size_t i) const
{
return this->v[i];
@@ -189,6 +209,14 @@ class rowmatrix final : public matrix<T, L, 1>
template<typename T, std::size_t L>
class colmatrix final : public matrix<T, 1, L>
{
+public:
+ constexpr colmatrix(const std::array<T, L> &vs) :
+ matrix<T, 1, L>(vs)
+ {}
+
+ constexpr colmatrix(T a) :
+ matrix<T, 1, L>(a) {}
+
constexpr T &operator[](std::size_t i) const
{
return this->v[i];