coord/ops: add a modulos function

This commit is contained in:
Danny Robson 2019-05-12 14:34:32 +10:00
parent 9a8679c733
commit b8af3d0d9e

View File

@ -878,11 +878,33 @@ namespace cruft {
std::cend (k),
std::begin (k),
[t] (auto v) { return mod (v, t);
});
});
return k;
}
//-------------------------------------------------------------------------
template <
typename A,
typename B,
typename = std::enable_if_t<
is_coord_v<std::decay_t<A>> && is_coord_v<std::decay_t<B>>
>
>
constexpr auto
mod (A &&a, B &&b)
{
return arithmetic<
std::decay_t<A>,
std::decay_t<B>
>::template eval (
std::modulus{},
std::forward<A> (a),
std::forward<B> (b)
);
}
///////////////////////////////////////////////////////////////////////////
// trigonometric functions
template <