mirror of
https://github.com/jbeder/yaml-cpp.git
synced 2025-09-09 20:51:16 +00:00
Added writing float/double
This commit is contained in:
@@ -132,19 +132,28 @@ namespace YAML
|
||||
if(!good())
|
||||
return *this;
|
||||
|
||||
PrepareNode(EmitterNodeType::Scalar);
|
||||
|
||||
std::stringstream stream;
|
||||
SetStreamablePrecision<T>(stream);
|
||||
stream << value;
|
||||
m_stream << stream.str();
|
||||
|
||||
StartedScalar();
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<>
|
||||
inline void Emitter::SetStreamablePrecision<float>(std::stringstream& str)
|
||||
inline void Emitter::SetStreamablePrecision<float>(std::stringstream& stream)
|
||||
{
|
||||
str.precision(GetFloatPrecision());
|
||||
stream.precision(GetFloatPrecision());
|
||||
}
|
||||
|
||||
template<>
|
||||
inline void Emitter::SetStreamablePrecision<double>(std::stringstream& str)
|
||||
inline void Emitter::SetStreamablePrecision<double>(std::stringstream& stream)
|
||||
{
|
||||
str.precision(GetDoublePrecision());
|
||||
stream.precision(GetDoublePrecision());
|
||||
}
|
||||
|
||||
// overloads of insertion
|
||||
|
Reference in New Issue
Block a user