mirror of
https://github.com/jbeder/yaml-cpp.git
synced 2025-10-27 22:41:21 +00:00
Use std::locale::classic() instead of creating new C locales on demand.
This commit is contained in:
committed by
Jesse Beder
parent
aa8d4e4750
commit
4fe2fb83fe
@@ -85,7 +85,7 @@ std::string FpToString(T v, int precision = 0) {
|
||||
// dragonbox/to_decimal does not handle value 0, inf, NaN
|
||||
if (v == 0 || std::isinf(v) || std::isnan(v)) {
|
||||
std::stringstream ss;
|
||||
ss.imbue(std::locale("C"));
|
||||
ss.imbue(std::locale::classic());
|
||||
ss << v;
|
||||
return ss.str();
|
||||
}
|
||||
@@ -98,7 +98,7 @@ std::string FpToString(T v, int precision = 0) {
|
||||
// defensive programming, ConvertToChars arguments are invalid
|
||||
if (digits_ct == -1) {
|
||||
std::stringstream ss;
|
||||
ss.imbue(std::locale("C"));
|
||||
ss.imbue(std::locale::classic());
|
||||
ss << v;
|
||||
return ss.str();
|
||||
}
|
||||
@@ -161,7 +161,7 @@ std::string FpToString(T v, int precision = 0) {
|
||||
// defensive programming, ConvertToChars arguments are invalid
|
||||
if (exp_digits_ct == -1) {
|
||||
std::stringstream ss;
|
||||
ss.imbue(std::locale("C"));
|
||||
ss.imbue(std::locale::classic());
|
||||
ss << v;
|
||||
return ss.str();
|
||||
}
|
||||
@@ -226,7 +226,7 @@ std::string FpToString(double v, size_t precision) {
|
||||
*/
|
||||
std::string FpToString(long double v, size_t precision) {
|
||||
std::stringstream ss;
|
||||
ss.imbue(std::locale("C"));
|
||||
ss.imbue(std::locale::classic());
|
||||
if (precision == 0) {
|
||||
precision = std::numeric_limits<long double>::max_digits10;
|
||||
}
|
||||
|
||||
@@ -310,7 +310,7 @@ void node_data::convert_sequence_to_map(const shared_memory_holder& pMemory) {
|
||||
reset_map();
|
||||
for (std::size_t i = 0; i < m_sequence.size(); i++) {
|
||||
std::stringstream stream;
|
||||
stream.imbue(std::locale("C"));
|
||||
stream.imbue(std::locale::classic());
|
||||
stream << i;
|
||||
|
||||
node& key = pMemory->create_node();
|
||||
|
||||
@@ -77,7 +77,7 @@ void Parser::HandleYamlDirective(const Token& token) {
|
||||
}
|
||||
|
||||
std::stringstream str(token.params[0]);
|
||||
str.imbue(std::locale("C"));
|
||||
str.imbue(std::locale::classic());
|
||||
str >> m_pDirectives->version.major;
|
||||
str.get();
|
||||
str >> m_pDirectives->version.minor;
|
||||
|
||||
Reference in New Issue
Block a user