libnum: add unary vector operators
This commit is contained in:
parent
cd95fad8d0
commit
ec74a983b3
|
@ -161,6 +161,16 @@ inline constexpr vec<T,N> &operator/=(vec<T,N> &lhs, T const &rhs) {
|
|||
return lhs;
|
||||
}
|
||||
|
||||
template<typename T, int N>
|
||||
inline constexpr vec<T,N> operator+(vec<T,N> const &lhs) {
|
||||
return lhs;
|
||||
}
|
||||
template<typename T, int N>
|
||||
inline constexpr vec<T,N> operator-(vec<T,N> lhs) {
|
||||
for(int i = 0; i < N; i++)
|
||||
lhs[i] = -lhs[i];
|
||||
return lhs;
|
||||
}
|
||||
template<typename T, int N>
|
||||
inline constexpr vec<T,N> operator+(vec<T,N> lhs, vec<T,N> const &rhs) {
|
||||
return lhs += rhs;
|
||||
|
|
Loading…
Reference in New Issue