mirror of
https://github.com/jbeder/yaml-cpp.git
synced 2025-09-09 12:41:17 +00:00
Patched for gcc version <= 3.3 (just fall back to original version of Node::Read)
This commit is contained in:
@@ -79,22 +79,22 @@ namespace YAML
|
|||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline bool operator == (const T& value, const Node& node) {
|
inline bool operator == (const T& value, const Node& node) {
|
||||||
return value == node.Read<T>();
|
return value == node.operator T();
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline bool operator == (const Node& node, const T& value) {
|
inline bool operator == (const Node& node, const T& value) {
|
||||||
return value == node.Read<T>();
|
return value == node.operator T();
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline bool operator != (const T& value, const Node& node) {
|
inline bool operator != (const T& value, const Node& node) {
|
||||||
return value != node.Read<T>();
|
return value != node.operator T();
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline bool operator != (const Node& node, const T& value) {
|
inline bool operator != (const Node& node, const T& value) {
|
||||||
return value != node.Read<T>();
|
return value != node.operator T();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool operator == (const char *value, const Node& node) {
|
inline bool operator == (const char *value, const Node& node) {
|
||||||
|
@@ -7,6 +7,17 @@ namespace YAML
|
|||||||
// thanks to litb from stackoverflow.com
|
// thanks to litb from stackoverflow.com
|
||||||
// http://stackoverflow.com/questions/1386183/how-to-call-a-templated-function-if-it-exists-and-something-else-otherwise/1386390#1386390
|
// http://stackoverflow.com/questions/1386183/how-to-call-a-templated-function-if-it-exists-and-something-else-otherwise/1386390#1386390
|
||||||
|
|
||||||
|
// Note: this doesn't work on gcc 3.2, but does on gcc 3.4 and above. I'm not sure about 3.3.
|
||||||
|
|
||||||
|
#if (__GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ <= 3))
|
||||||
|
// trick doesn't work? Just fall back to ConvertScalar.
|
||||||
|
// This means that we can't use any user-defined types as keys in a map
|
||||||
|
template <typename T>
|
||||||
|
inline bool Node::Read(T& value) const {
|
||||||
|
return ConvertScalar(*this, value);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
// usual case: the trick!
|
||||||
template<bool>
|
template<bool>
|
||||||
struct read_impl;
|
struct read_impl;
|
||||||
|
|
||||||
@@ -52,6 +63,7 @@ namespace YAML
|
|||||||
|
|
||||||
return read_impl<sizeof (fallback::flag(), Convert(std::string(), value), fallback::flag()) != 1>::read(*this, value);
|
return read_impl<sizeof (fallback::flag(), Convert(std::string(), value), fallback::flag()) != 1>::read(*this, value);
|
||||||
}
|
}
|
||||||
|
#endif // done with trick
|
||||||
|
|
||||||
// the main conversion function
|
// the main conversion function
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
Reference in New Issue
Block a user