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,7 +47,22 @@ namespace YAML
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// C-strings can only be encoded
|
||||||
template<>
|
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> {
|
struct convert<_Null> {
|
||||||
static Node encode(const _Null& /* rhs */) {
|
static Node encode(const _Null& /* rhs */) {
|
||||||
return Node();
|
return Node();
|
||||||
|
@@ -149,7 +149,12 @@ namespace YAML
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
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)
|
inline node& node_data::convert_to_node(const T& rhs, shared_memory_holder pMemory)
|
||||||
{
|
{
|
||||||
Node value = convert<T>::encode(rhs);
|
Node value = convert<T>::encode(rhs);
|
||||||
|
@@ -77,6 +77,7 @@ namespace YAML
|
|||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
static bool equals(node& node, const T& rhs, shared_memory_holder pMemory);
|
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>
|
template<typename T>
|
||||||
static node& convert_to_node(const T& rhs, shared_memory_holder pMemory);
|
static node& convert_to_node(const T& rhs, shared_memory_holder pMemory);
|
||||||
|
Reference in New Issue
Block a user