diff --git a/include/yaml-cpp/node/convert.h b/include/yaml-cpp/node/convert.h index a8de752..146067b 100644 --- a/include/yaml-cpp/node/convert.h +++ b/include/yaml-cpp/node/convert.h @@ -47,7 +47,22 @@ namespace YAML } }; + // C-strings can only be encoded template<> + struct convert { + static Node encode(const char *&rhs) { + return Node(rhs); + } + }; + + template + struct convert { + static Node encode(const char (&rhs)[N]) { + return Node(rhs); + } + }; + + template<> struct convert<_Null> { static Node encode(const _Null& /* rhs */) { return Node(); diff --git a/include/yaml-cpp/node/detail/impl.h b/include/yaml-cpp/node/detail/impl.h index c618758..ce5fd57 100644 --- a/include/yaml-cpp/node/detail/impl.h +++ b/include/yaml-cpp/node/detail/impl.h @@ -149,7 +149,12 @@ namespace YAML return false; } - template + inline bool node_data::equals(node& node, const char *rhs, shared_memory_holder pMemory) + { + return equals(node, rhs, pMemory); + } + + template inline node& node_data::convert_to_node(const T& rhs, shared_memory_holder pMemory) { Node value = convert::encode(rhs); diff --git a/include/yaml-cpp/node/detail/node_data.h b/include/yaml-cpp/node/detail/node_data.h index 7fe05b8..413da5f 100644 --- a/include/yaml-cpp/node/detail/node_data.h +++ b/include/yaml-cpp/node/detail/node_data.h @@ -77,6 +77,7 @@ namespace YAML template static bool equals(node& node, const T& rhs, shared_memory_holder pMemory); + static bool equals(node& node, const char *rhs, shared_memory_holder pMemory); template static node& convert_to_node(const T& rhs, shared_memory_holder pMemory);