coord/ops: don't use multiplication for negation
This commit is contained in:
parent
5ed95ec952
commit
634f2af9cc
@ -171,10 +171,20 @@ namespace util {
|
|||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
// negation
|
// negation
|
||||||
template <size_t S, typename T, template<size_t,typename> class K>
|
template <
|
||||||
K<S,T> operator- (K<S,T> k)
|
size_t S,
|
||||||
|
typename T,
|
||||||
|
template<size_t,typename> class K
|
||||||
|
>
|
||||||
|
typename std::enable_if<
|
||||||
|
std::is_signed<T>::value,
|
||||||
|
K<S,T>
|
||||||
|
>::type
|
||||||
|
operator- (K<S,T> k)
|
||||||
{
|
{
|
||||||
return k * T{-1};
|
for (auto &v: k)
|
||||||
|
v = -v;
|
||||||
|
return k;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user