xtd 0.2.0
Loading...
Searching...
No Matches
__natural_formatter.hpp
Go to the documentation of this file.
1
3#pragma once
5#if !defined(__XTD_CORE_INTERNAL__)
6#error "Do not include this file: Internal use only"
7#endif
9
10#include <iomanip>
11#include <locale>
12#include <string>
13#include <sstream>
14
16template<typename char_t>
17inline std::basic_string<char_t> __natural_formatter(long double value, int precision, const std::locale& loc) {
18 std::basic_stringstream<char_t> ss;
19 ss.imbue(loc);
20 ss << std::fixed << std::setprecision(precision) << value;
21 return ss.str();
22}