mirror of
https://github.com/jbeder/yaml-cpp.git
synced 2025-09-09 12:41:17 +00:00
Refactored the operator >> and Node::Read default functions, as well as the conversion functions, to more easily read new types as keys (this uncovered an error, in example 2.11 of the spec)
This commit is contained in:
@@ -9,15 +9,6 @@
|
||||
namespace YAML
|
||||
{
|
||||
// implementation of templated things
|
||||
template <typename T>
|
||||
inline bool Node::Read(T& value) const {
|
||||
std::string scalar;
|
||||
if(!GetScalar(scalar))
|
||||
return false;
|
||||
|
||||
return Convert(scalar, value);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline const T Node::Read() const {
|
||||
T value;
|
||||
@@ -32,7 +23,7 @@ namespace YAML
|
||||
|
||||
template <typename T>
|
||||
inline void operator >> (const Node& node, T& value) {
|
||||
if(!node.Read(value))
|
||||
if(!ConvertScalar(node, value))
|
||||
throw InvalidScalar(node.m_mark);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user