diff options
-rw-r--r-- | compat/util.hpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/compat/util.hpp b/compat/util.hpp index 80ab4270..528ae1a8 100644 --- a/compat/util.hpp +++ b/compat/util.hpp @@ -3,6 +3,7 @@ #include "make-unique.hpp" #include <memory> +#include <cmath> #include <utility> #include <type_traits> #include <thread> @@ -21,6 +22,12 @@ template<typename t> using ptr = std::unique_ptr<t>; # define DEFUN_WARN_UNUSED __attribute__((warn_unused_result)) #endif +template<typename t> +int iround(const t& val) +{ + return int(std::round(val)); +} + namespace detail { template<typename n> |