mirror of https://github.com/gabime/spdlog.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
552 B
C++
34 lines
552 B
C++
#pragma once
|
|
|
|
#include <functional>
|
|
#include <chrono>
|
|
#include <iostream>
|
|
#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();
|
|
}
|
|
|
|
}
|