mirror of
https://github.com/jbeder/yaml-cpp.git
synced 2025-09-09 12:41:17 +00:00
Fix conversion for C-strings (both literals and normal C-strings) so it compiles on Visual Studio.
This commit is contained in:
@@ -47,6 +47,21 @@ namespace YAML
|
||||
}
|
||||
};
|
||||
|
||||
// C-strings can only be encoded
|
||||
template<>
|
||||
struct convert<const char *> {
|
||||
static Node encode(const char *&rhs) {
|
||||
return Node(rhs);
|
||||
}
|
||||
};
|
||||
|
||||
template<std::size_t N>
|
||||
struct convert<const char[N]> {
|
||||
static Node encode(const char (&rhs)[N]) {
|
||||
return Node(rhs);
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct convert<_Null> {
|
||||
static Node encode(const _Null& /* rhs */) {
|
||||
|
@@ -149,6 +149,11 @@ namespace YAML
|
||||
return false;
|
||||
}
|
||||
|
||||
inline bool node_data::equals(node& node, const char *rhs, shared_memory_holder pMemory)
|
||||
{
|
||||
return equals<std::string>(node, rhs, pMemory);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline node& node_data::convert_to_node(const T& rhs, shared_memory_holder pMemory)
|
||||
{
|
||||
|
@@ -77,6 +77,7 @@ namespace YAML
|
||||
|
||||
template<typename T>
|
||||
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<typename T>
|
||||
static node& convert_to_node(const T& rhs, shared_memory_holder pMemory);
|
||||
|
Reference in New Issue
Block a user