mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-30 00:00:11 +01:00

git-subtree-dir: thirdparty/spdlog git-subtree-split: 32177aa77a0a20453d3e7455cac42406fc49b6ca
35 lines
607 B
C++
35 lines
607 B
C++
//
|
|
// Copyright(c) 2015 Gabi Melman.
|
|
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
|
|
//
|
|
|
|
#pragma once
|
|
|
|
#include <sstream>
|
|
#include <iomanip>
|
|
#include <locale>
|
|
|
|
namespace utils
|
|
{
|
|
|
|
template<typename T>
|
|
inline std::string format(const T& value)
|
|
{
|
|
static std::locale loc("");
|
|
std::stringstream ss;
|
|
ss.imbue(loc);
|
|
ss << value;
|
|
return ss.str();
|
|
}
|
|
|
|
template<>
|
|
inline std::string format(const double & value)
|
|
{
|
|
static std::locale loc("");
|
|
std::stringstream ss;
|
|
ss.imbue(loc);
|
|
ss << std::fixed << std::setprecision(1) << value;
|
|
return ss.str();
|
|
}
|
|
|
|
}
|