Commit d92ca21b by Jesse Beder

Added templated Read() function that creates the output variable itself (so you…

Added templated Read() function that creates the output variable itself (so you don't need to have a temp variable)
parent 487f381a
......@@ -50,6 +50,9 @@ namespace YAML
bool Read(T& value) const;
template <typename T>
const T Read() const;
template <typename T>
friend void operator >> (const Node& node, T& value);
// just for maps
......
......@@ -17,6 +17,13 @@ namespace YAML
}
template <typename T>
inline const T Node::Read() const {
T value;
*this >> value;
return value;
}
template <typename T>
inline void operator >> (const Node& node, T& value) {
if(!node.Read(value))
throw InvalidScalar(node.m_mark);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment