From 9c4e1586334b2e978d3993c97031d79f079f9650 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Wed, 26 Oct 2016 06:52:25 +0200 Subject: compat/util: introduce "iround" for round to integer --- compat/util.hpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'compat') 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 +#include #include #include #include @@ -21,6 +22,12 @@ template using ptr = std::unique_ptr; # define DEFUN_WARN_UNUSED __attribute__((warn_unused_result)) #endif +template +int iround(const t& val) +{ + return int(std::round(val)); +} + namespace detail { template -- cgit v1.2.3