diff --git a/single_include/toml.hpp b/single_include/toml.hpp index f43cfd2..78e8603 100644 --- a/single_include/toml.hpp +++ b/single_include/toml.hpp @@ -3577,6 +3577,14 @@ struct has_into_toml_method_impl static std::false_type check(...); }; +struct has_template_into_toml_method_impl +{ + template + static std::true_type check(decltype(std::declval().template into_toml())*); + template + static std::false_type check(...); +}; + struct has_specialized_from_impl { template @@ -3620,6 +3628,9 @@ struct has_from_toml_method: decltype(has_from_toml_method_impl::check(nu template struct has_into_toml_method: decltype(has_into_toml_method_impl::check(nullptr)){}; +template +struct has_template_into_toml_method: decltype(has_template_into_toml_method_impl::check(nullptr)){}; + template struct has_specialized_from: decltype(has_specialized_from_impl::check(nullptr)){}; template @@ -6660,6 +6671,29 @@ class basic_value *this = ud.into_toml(); return *this; } + + template, + cxx::negation> + >::value, std::nullptr_t> = nullptr> + basic_value(const T& ud): basic_value(ud.template into_toml()) {} + + template, + cxx::negation> + >::value, std::nullptr_t> = nullptr> + basic_value(const T& ud, std::vector com) + : basic_value(ud.template into_toml(), std::move(com)) + {} + template, + cxx::negation> + >::value, std::nullptr_t> = nullptr> + basic_value& operator=(const T& ud) + { + *this = ud.template into_toml(); + return *this; + } // }}} // empty value with region info ======================================= {{{