mirror of
https://github.com/jbeder/yaml-cpp.git
synced 2025-11-26 12:31:44 +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
@@ -148,7 +148,7 @@ inline Emitter& Emitter::WriteIntegralType(T value) {
|
||||
PrepareNode(EmitterNodeType::Scalar);
|
||||
|
||||
std::stringstream stream;
|
||||
stream.imbue(std::locale("C"));
|
||||
stream.imbue(std::locale::classic());
|
||||
PrepareIntegralStream(stream);
|
||||
stream << value;
|
||||
m_stream << stream.str();
|
||||
@@ -166,7 +166,7 @@ inline Emitter& Emitter::WriteStreamable(T value) {
|
||||
PrepareNode(EmitterNodeType::Scalar);
|
||||
|
||||
std::stringstream stream;
|
||||
stream.imbue(std::locale("C"));
|
||||
stream.imbue(std::locale::classic());
|
||||
SetStreamablePrecision<T>(stream);
|
||||
|
||||
bool special = false;
|
||||
|
||||
@@ -172,7 +172,7 @@ ConvertStreamTo(std::stringstream& stream, T& rhs) {
|
||||
\
|
||||
static Node encode(const type& rhs) { \
|
||||
std::stringstream stream; \
|
||||
stream.imbue(std::locale("C")); \
|
||||
stream.imbue(std::locale::classic()); \
|
||||
stream.precision(std::numeric_limits<type>::max_digits10); \
|
||||
conversion::inner_encode(rhs, stream); \
|
||||
return Node(stream.str()); \
|
||||
@@ -184,7 +184,7 @@ ConvertStreamTo(std::stringstream& stream, T& rhs) {
|
||||
} \
|
||||
const std::string& input = node.Scalar(); \
|
||||
std::stringstream stream(input); \
|
||||
stream.imbue(std::locale("C")); \
|
||||
stream.imbue(std::locale::classic()); \
|
||||
stream.unsetf(std::ios::dec); \
|
||||
if ((stream.peek() == '-') && std::is_unsigned<type>::value) { \
|
||||
return false; \
|
||||
|
||||
@@ -121,7 +121,7 @@ template<typename Key, bool Streamable>
|
||||
struct streamable_to_string {
|
||||
static std::string impl(const Key& key) {
|
||||
std::stringstream ss;
|
||||
ss.imbue(std::locale("C"));
|
||||
ss.imbue(std::locale::classic());
|
||||
ss << key;
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user