From ee7499d5844243cf31f84b6a9f3eac8beae97b22 Mon Sep 17 00:00:00 2001 From: Siarhei Fedartsou Date: Sat, 1 Oct 2022 13:47:06 +0200 Subject: [PATCH] use fmt --- include/util/cast.hpp | 49 ---------------------------------- include/util/json_renderer.hpp | 1 - 2 files changed, 50 deletions(-) delete mode 100644 include/util/cast.hpp diff --git a/include/util/cast.hpp b/include/util/cast.hpp deleted file mode 100644 index 1a420fa3a..000000000 --- a/include/util/cast.hpp +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef CAST_HPP -#define CAST_HPP - -#include -#include -#include -#include - -#include -#include - -namespace osrm -{ -namespace util -{ - -namespace cast -{ -template -inline auto enum_to_underlying(Enumeration const value) -> - typename std::underlying_type::type -{ - return static_cast::type>(value); -} - -template inline std::string to_string_with_precision(const T x) -{ - static_assert(std::is_arithmetic::value, "integral or floating point type required"); - - std::ostringstream out; - out << std::fixed << std::setprecision(Precision) << x; - auto rv = out.str(); - - // Javascript has no separation of float / int, digits without a '.' are integral typed - // X.Y.0 -> X.Y - // X.0 -> X - boost::trim_right_if(rv, boost::is_any_of("0")); - boost::trim_right_if(rv, boost::is_any_of(".")); - // Note: - // - assumes the locale to use '.' as digit separator - // - this is not identical to: trim_right_if(rv, is_any_of('0 .')) - - return rv; -} -} // namespace cast -} // namespace util -} // namespace osrm - -#endif // CAST_HPP diff --git a/include/util/json_renderer.hpp b/include/util/json_renderer.hpp index bcbb2db5c..02e560d31 100644 --- a/include/util/json_renderer.hpp +++ b/include/util/json_renderer.hpp @@ -4,7 +4,6 @@ #ifndef JSON_RENDERER_HPP #define JSON_RENDERER_HPP -#include "util/cast.hpp" #include "util/ieee754.hpp" #include "util/string_util.hpp"