diff --git a/toml/get.hpp b/toml/get.hpp index 901790b..ac1b354 100644 --- a/toml/get.hpp +++ b/toml/get.hpp @@ -260,6 +260,11 @@ template::value, T> get(const basic_value&); +template class M, template class V> +detail::enable_if_t::value, T> +get(basic_value&); + // T(const toml::value&) and T is not toml::basic_value, // and it does not have `from` nor `from_toml`. template::value, T> get(const basic_value&); +template class M, template class V> +detail::enable_if_t>, + std::is_constructible&>, + detail::negation>, + detail::negation> + >::value, T> +get(basic_value&); + // ============================================================================ // array-like types; most likely STL container, like std::vector, etc. @@ -451,6 +466,13 @@ get(const basic_value& v) { return ::toml::from::from_toml(v); } +template class M, template class V> +detail::enable_if_t::value, T> +get(basic_value& v) +{ + return ::toml::from::from_toml(v); +} template class M, template class V> @@ -465,6 +487,19 @@ get(const basic_value& v) return T(v); } +template class M, template class V> +detail::enable_if_t>, // T is not a toml::value + std::is_constructible&>, // T is constructible from toml::value + detail::negation>, // and T does not have T.from_toml(v); + detail::negation> // and T does not have toml::from{}; + >::value, T> +get(basic_value& v) +{ + return T(v); +} + // ============================================================================ // find