spdlog
Loading...
Searching...
No Matches
bench/utils.h
Go to the documentation of this file.
1//
2// Copyright(c) 2015 Gabi Melman.
3// Distributed under the MIT License (http://opensource.org/licenses/MIT)
4//
5
6#pragma once
7
8#include <iomanip>
9#include <locale>
10#include <sstream>
11
12namespace utils {
13
14template<typename T>
15inline std::string format(const T &value)
16{
17 static std::locale loc("");
19 ss.imbue(loc);
20 ss << value;
21 return ss.str();
22}
23
24template<>
25inline std::string format(const double &value)
26{
27 static std::locale loc("");
29 ss.imbue(loc);
30 ss << std::fixed << std::setprecision(1) << value;
31 return ss.str();
32}
33
34} // namespace utils
Definition core.h:1120
T
Definition core.h:320
T fixed(T... args)
T imbue(T... args)
std::string format(const T &value)
Definition bench/utils.h:15
T setprecision(T... args)
T str(T... args)