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 <sstream>
9#include <iomanip>
10#include <locale>
11
12namespace utils
13{
14
15template<typename T>
16inline std::string format(const T& value)
17{
18    static std::locale loc("");
19    std::stringstream ss;
20    ss.imbue(loc);
21    ss << value;
22    return ss.str();
23}
24
25template<>
26inline std::string format(const double & value)
27{
28    static std::locale loc("");
29    std::stringstream ss;
30    ss.imbue(loc);
31    ss << std::fixed << std::setprecision(1) << value;
32    return ss.str();
33}
34
35}
36