diff --git a/coord/ops.hpp b/coord/ops.hpp index fddc3383..63d5cf84 100644 --- a/coord/ops.hpp +++ b/coord/ops.hpp @@ -22,6 +22,7 @@ #include "../types/bits.hpp" #include +#include namespace util { // forward declerations for traits @@ -323,6 +324,22 @@ namespace util { bool operator<= (K k, T t) { return max (k) <= t; } + + + /////////////////////////////////////////////////////////////////////////// + template class K> + typename std::enable_if< + std::is_floating_point::value, + K + >::type + floor (K k) + { + T (*floor_func)(T) = std::floor; + + K v; + std::transform (k.begin (), k.end (), v.begin (), floor_func); + return v; + } } #endif