Commit 97d56c3f authored by Jesse Beder's avatar Jesse Beder
Browse files

Remove 'const' modifier on return of Node::as.

This enables the return value to be moved, rather than copied.
parent 320b02b1
......@@ -87,7 +87,7 @@ struct as_if {
explicit as_if(const Node& node_) : node(node_) {}
const Node& node;
const T operator()(const S& fallback) const {
T operator()(const S& fallback) const {
if (!node.m_pNode)
return fallback;
......@@ -140,14 +140,14 @@ struct as_if<std::string, void> {
// access functions
template <typename T>
inline const T Node::as() const {
inline T Node::as() const {
if (!m_isValid)
throw InvalidNode();
return as_if<T, void>(*this)();
}
template <typename T, typename S>
inline const T Node::as(const S& fallback) const {
inline T Node::as(const S& fallback) const {
if (!m_isValid)
return fallback;
return as_if<T, S>(*this)(fallback);
......
......@@ -63,9 +63,9 @@ class YAML_CPP_API Node {
// access
template <typename T>
const T as() const;
T as() const;
template <typename T, typename S>
const T as(const S& fallback) const;
T as(const S& fallback) const;
const std::string& Scalar() const;
const std::string& Tag() const;
......
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