diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2017-08-10 16:14:30 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2017-08-14 19:19:59 +0200 |
commit | 742fdf7d20936cd71a009f96dfb94610b336bc97 (patch) | |
tree | 600932d0866bbaf43647ee59f8826b2f35dd6fe1 /compat/simple-mat.hpp | |
parent | 07f16d4ff648fee65cb3f7aaf313e9616179e9d0 (diff) |
use c++14 features
Diffstat (limited to 'compat/simple-mat.hpp')
-rw-r--r-- | compat/simple-mat.hpp | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/compat/simple-mat.hpp b/compat/simple-mat.hpp index ca49ea5a..d983f79b 100644 --- a/compat/simple-mat.hpp +++ b/compat/simple-mat.hpp @@ -58,61 +58,61 @@ class Mat num data[h_][w_]; public: - template<int Q = w_> typename std::enable_if<equals<Q, 1, 0>::value, num>::type + template<int Q = w_> std::enable_if_t<equals<Q, 1, 0>::value, num> inline operator()(int i) const { return data[i][0]; } - template<int P = h_> typename std::enable_if<equals<P, 1, 1>::value, num>::type + template<int P = h_> std::enable_if_t<equals<P, 1, 1>::value, num> inline operator()(int i) const { return data[0][i]; } - template<int Q = w_> typename std::enable_if<equals<Q, 1, 2>::value, num&>::type + template<int Q = w_> std::enable_if_t<equals<Q, 1, 2>::value, num&> inline operator()(int i) { return data[i][0]; } - template<int P = h_> typename std::enable_if<equals<P, 1, 3>::value, num&>::type + template<int P = h_> std::enable_if_t<equals<P, 1, 3>::value, num&> inline operator()(int i) { return data[0][i]; } - template<int Q = w_> typename std::enable_if<equals<Q, 1, 0>::value, num>::type + template<int Q = w_> std::enable_if_t<equals<Q, 1, 0>::value, num> inline operator()(unsigned i) const { return data[i][0]; } - template<int P = h_> typename std::enable_if<equals<P, 1, 1>::value, num>::type + template<int P = h_> std::enable_if_t<equals<P, 1, 1>::value, num> inline operator()(unsigned i) const { return data[0][i]; } - template<int Q = w_> typename std::enable_if<equals<Q, 1, 2>::value, num&>::type + template<int Q = w_> std::enable_if_t<equals<Q, 1, 2>::value, num&> inline operator()(unsigned i) { return data[i][0]; } - template<int P = h_> typename std::enable_if<equals<P, 1, 3>::value, num&>::type + template<int P = h_> std::enable_if_t<equals<P, 1, 3>::value, num&> inline operator()(unsigned i) { return data[0][i]; } #define OPENTRACK_ASSERT_SWIZZLE static_assert(P == h_ && Q == w_, "") - template<int P = h_, int Q = w_> typename std::enable_if<maybe_add_swizzle<P, Q, 1>::value, num>::type + template<int P = h_, int Q = w_> std::enable_if_t<maybe_add_swizzle<P, Q, 1>::value, num> x() const { OPENTRACK_ASSERT_SWIZZLE; return operator()(0); } - template<int P = h_, int Q = w_> typename std::enable_if<maybe_add_swizzle<P, Q, 2>::value, num>::type + template<int P = h_, int Q = w_> std::enable_if_t<maybe_add_swizzle<P, Q, 2>::value, num> y() const { OPENTRACK_ASSERT_SWIZZLE; return operator()(1); } - template<int P = h_, int Q = w_> typename std::enable_if<maybe_add_swizzle<P, Q, 3>::value, num>::type + template<int P = h_, int Q = w_> std::enable_if_t<maybe_add_swizzle<P, Q, 3>::value, num> z() const { OPENTRACK_ASSERT_SWIZZLE; return operator()(2); } - template<int P = h_, int Q = w_> typename std::enable_if<maybe_add_swizzle<P, Q, 4>::value, num>::type + template<int P = h_, int Q = w_> std::enable_if_t<maybe_add_swizzle<P, Q, 4>::value, num> w() const { OPENTRACK_ASSERT_SWIZZLE; return operator()(3); } - template<int P = h_, int Q = w_> typename std::enable_if<maybe_add_swizzle<P, Q, 1>::value, num&>::type + template<int P = h_, int Q = w_> std::enable_if_t<maybe_add_swizzle<P, Q, 1>::value, num&> x() { OPENTRACK_ASSERT_SWIZZLE; return operator()(0); } - template<int P = h_, int Q = w_> typename std::enable_if<maybe_add_swizzle<P, Q, 2>::value, num&>::type + template<int P = h_, int Q = w_> std::enable_if_t<maybe_add_swizzle<P, Q, 2>::value, num&> y() { OPENTRACK_ASSERT_SWIZZLE; return operator()(1); } - template<int P = h_, int Q = w_> typename std::enable_if<maybe_add_swizzle<P, Q, 3>::value, num&>::type + template<int P = h_, int Q = w_> std::enable_if_t<maybe_add_swizzle<P, Q, 3>::value, num&> z() { OPENTRACK_ASSERT_SWIZZLE; return operator()(2); } - template<int P = h_, int Q = w_> typename std::enable_if<maybe_add_swizzle<P, Q, 4>::value, num&>::type + template<int P = h_, int Q = w_> std::enable_if_t<maybe_add_swizzle<P, Q, 4>::value, num&> w() { OPENTRACK_ASSERT_SWIZZLE; return operator()(3); } // parameters w_ and h_ are rebound so that SFINAE occurs // removing them causes a compile-time error -sh 20150811 template<int R, int S, int P = h_, int Q = w_> - typename std::enable_if<is_vector_pair<R, S, P, Q>::value, num>::type + std::enable_if_t<is_vector_pair<R, S, P, Q>::value, num> norm() const { static_assert(P == h_ && Q == w_, ""); @@ -126,7 +126,7 @@ public: } template<int R, int S, int P = h_, int Q = w_> - typename std::enable_if<is_vector_pair<R, S, P, Q>::value, num>::type + std::enable_if_t<is_vector_pair<R, S, P, Q>::value, num> dot(const Mat<num, R, S>& p2) const { static_assert(P == h_ && Q == w_, ""); @@ -139,7 +139,7 @@ public: } template<int R, int S, int P = h_, int Q = w_> - typename std::enable_if<is_dim3<P, Q, R, S>::value, Mat<num, is_dim3<P, Q, R, S>::P, is_dim3<P, Q, R, S>::Q>>::type + std::enable_if_t<is_dim3<P, Q, R, S>::value, Mat<num, is_dim3<P, Q, R, S>::P, is_dim3<P, Q, R, S>::Q>> cross(const Mat<num, R, S>& b) const { static_assert(P == h_ && Q == w_, ""); @@ -212,7 +212,7 @@ public: #endif template<typename... ts, int h__ = h_, int w__ = w_, - typename = typename std::enable_if<is_arglist_correct<num, h__, w__, ts...>::value>::type> + typename = std::enable_if_t<is_arglist_correct<num, h__, w__, ts...>::value>> Mat(const ts... xs) : data{static_cast<num>(xs)...} { static_assert(h__ == h_ && w__ == w_, ""); @@ -243,7 +243,7 @@ public: // not needed merely for matrix algebra -sh 20141030 template<int h__ = h_> - static typename std::enable_if<h_ == w_, Mat<num, h__, h__>>::type eye() + static std::enable_if_t<h_ == w_, Mat<num, h__, h__>> eye() { static_assert(h_ == h__, ""); |