Implemented conversion for std::string, including a bypass-accessor to the scalar value

This commit is contained in:
Jesse Beder
2011-09-07 15:49:01 -05:00
parent 1ab16bac62
commit a95baeafd6
7 changed files with 41 additions and 3 deletions

17
src/value/convert.cpp Normal file
View File

@@ -0,0 +1,17 @@
#include "yaml-cpp/value.h"
namespace YAML
{
template<>
Value convert(const std::string& rhs) {
return Value(rhs);
}
template<>
bool convert(const Value& value, std::string& rhs) {
if(value.Type() != ValueType::Scalar)
return false;
rhs = value.scalar();
return true;
}
}