From d1c6df8bf1884aa98c2079e86c67cd67a2b83729 Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Mon, 12 Mar 2018 23:04:17 +1100 Subject: [PATCH] coord/ops: add simple cosine wrapper --- coord/ops.hpp | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/coord/ops.hpp b/coord/ops.hpp index 32d25d59..1286ccfd 100644 --- a/coord/ops.hpp +++ b/coord/ops.hpp @@ -1391,7 +1391,27 @@ namespace std { return v; } }; -} + + template < + typename CoordT, + typename = std::enable_if_t< + ::util::is_coord_v, void + > + > + auto cos (CoordT val) + { + CoordT out; + + std::transform ( + std::begin (val), + std::end (val), + std::begin (out), + [] (auto i) { return ::std::cos (i); } + ); + + return out; + } +}; #endif