diff options
Diffstat (limited to 'src/libs/3rdparty/yaml-cpp/include/yaml-cpp/traits.h')
-rw-r--r-- | src/libs/3rdparty/yaml-cpp/include/yaml-cpp/traits.h | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/traits.h b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/traits.h index f33d0e1f63..ffe9999f19 100644 --- a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/traits.h +++ b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/traits.h @@ -7,6 +7,11 @@ #pragma once #endif +#include <type_traits> +#include <utility> +#include <string> +#include <sstream> + namespace YAML { template <typename> struct is_numeric { @@ -79,7 +84,7 @@ struct is_numeric<long double> { template <bool, class T = void> struct enable_if_c { - typedef T type; + using type = T; }; template <class T> @@ -90,7 +95,7 @@ struct enable_if : public enable_if_c<Cond::value, T> {}; template <bool, class T = void> struct disable_if_c { - typedef T type; + using type = T; }; template <class T> @@ -100,4 +105,31 @@ template <class Cond, class T = void> struct disable_if : public disable_if_c<Cond::value, T> {}; } +template <typename S, typename T> +struct is_streamable { + template <typename StreamT, typename ValueT> + static auto test(int) + -> decltype(std::declval<StreamT&>() << std::declval<ValueT>(), std::true_type()); + + template <typename, typename> + static auto test(...) -> std::false_type; + + static const bool value = decltype(test<S, T>(0))::value; +}; + +template<typename Key, bool Streamable> +struct streamable_to_string { + static std::string impl(const Key& key) { + std::stringstream ss; + ss << key; + return ss.str(); + } +}; + +template<typename Key> +struct streamable_to_string<Key, false> { + static std::string impl(const Key&) { + return ""; + } +}; #endif // TRAITS_H_62B23520_7C8E_11DE_8A39_0800200C9A66 |