coord: add constexpr constructors

This commit is contained in:
Danny Robson 2015-07-21 01:38:36 +10:00
parent f451e5555e
commit 950fed7d81
2 changed files with 10 additions and 10 deletions

View File

@ -39,10 +39,10 @@ namespace util { namespace coord {
using init<S,T,tags...>::init; using init<S,T,tags...>::init;
base () = default; base () = default;
explicit base (T val) constexpr explicit base (T val)
{ std::fill (std::begin (this->data), std::end (this->data), val); } { std::fill (std::begin (this->data), std::end (this->data), val); }
base (const base<S,T,KLASS,tags...> &rhs) = default; constexpr base (const base<S,T,KLASS,tags...> &rhs) = default;
base& operator= (const base<S,T,KLASS,tags...> &rhs) = default; base& operator= (const base<S,T,KLASS,tags...> &rhs) = default;
// element accessors // element accessors

View File

@ -30,8 +30,8 @@ namespace util { namespace coord {
struct init<1,T,tags...> : public store<1,T,tags...> struct init<1,T,tags...> : public store<1,T,tags...>
{ {
using store<1,T,tags...>::store; using store<1,T,tags...>::store;
init () = default; constexpr init () = default;
init (T v0): constexpr init (T v0):
store<1,T,tags...> ({v0}) store<1,T,tags...> ({v0})
{ ; } { ; }
}; };
@ -42,8 +42,8 @@ namespace util { namespace coord {
struct init<2,T,tags...> : public store<2,T,tags...> struct init<2,T,tags...> : public store<2,T,tags...>
{ {
using store<2,T,tags...>::store; using store<2,T,tags...>::store;
init () = default; constexpr init () = default;
init (T v0, T v1): constexpr init (T v0, T v1):
store<2,T,tags...> ({ v0, v1 }) store<2,T,tags...> ({ v0, v1 })
{ ; } { ; }
}; };
@ -54,8 +54,8 @@ namespace util { namespace coord {
struct init<3,T,tags...> : public store<3,T,tags...> struct init<3,T,tags...> : public store<3,T,tags...>
{ {
using store<3,T,tags...>::store; using store<3,T,tags...>::store;
init () = default; constexpr init () = default;
init (T v0, T v1, T v2): constexpr init (T v0, T v1, T v2):
store<3,T,tags...> ({v0, v1, v2}) store<3,T,tags...> ({v0, v1, v2})
{ ; } { ; }
}; };
@ -66,8 +66,8 @@ namespace util { namespace coord {
struct init<4,T,tags...> : public store<4,T,tags...> struct init<4,T,tags...> : public store<4,T,tags...>
{ {
using store<4,T,tags...>::store; using store<4,T,tags...>::store;
init () = default; constexpr init () = default;
init (T v0, T v1, T v2, T v3): constexpr init (T v0, T v1, T v2, T v3):
store<4,T,tags...> ({ v0, v1, v2, v3 }) store<4,T,tags...> ({ v0, v1, v2, v3 })
{ ; } { ; }
}; };