diff options
author | Nao Pross <naopross@thearcway.org> | 2019-02-23 14:58:43 +0100 |
---|---|---|
committer | Nao Pross <naopross@thearcway.org> | 2019-02-23 14:59:14 +0100 |
commit | 5e3180582b34ed8db878506a5f2f8a372e5af6bf (patch) | |
tree | c11cfeaf686891a932e6fded12fdee32e603bd7b | |
parent | Add test to cmake (diff) | |
download | libmm-5e3180582b34ed8db878506a5f2f8a372e5af6bf.tar.gz libmm-5e3180582b34ed8db878506a5f2f8a372e5af6bf.zip |
Make childs inherit all basic_vec constructors with lang syntax
-rw-r--r-- | include/mmvec.hpp | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/include/mmvec.hpp b/include/mmvec.hpp index 21e91b5..1939388 100644 --- a/include/mmvec.hpp +++ b/include/mmvec.hpp @@ -222,10 +222,7 @@ std::ostream& operator<<(std::ostream& os, const mm::basic_vec<T, d>& v) { template<typename T, std::size_t d> class mm::vec: public mm::basic_vec<T, d> { public: - vec(std::initializer_list<T> l) : basic_vec<T, d>(l) {} - - template<std::size_t n> - vec(const basic_vec<T, n>& other) : basic_vec<T, d>(other) {} + using mm::basic_vec<T, d>::basic_vec; }; @@ -235,11 +232,7 @@ public: template<typename T> class mm::vec3 : public mm::basic_vec<T, 3> { public: - vec3() : basic_vec<T, 3>() {} - vec3(std::initializer_list<T> l) : basic_vec<T, 3>(l) {} - - template<std::size_t n> - vec3(const basic_vec<T, n>& other) : basic_vec<T, 3>(other) {} + using mm::basic_vec<T, 3>::basic_vec; T& x() { return this->at(0); } T& y() { return this->at(1); } @@ -293,11 +286,7 @@ mm::vec3<T> mm::vec3<T>::cross(const vec3<T>& rhs, const vec3<T>& lhs) { template<typename T> class mm::vec2: public mm::basic_vec<T, 2> { public: - vec2() : basic_vec<T, 2>() {} - vec2(std::initializer_list<T> l) : basic_vec<T, 2>(l) {} - - template<std::size_t n> - vec2(const basic_vec<T, n>& other) : basic_vec<T, 2>(other) {} + using mm::basic_vec<T, 2>::basic_vec; T& x() { return this->at(0); } T& y() { return this->at(1); } |