mirror of
https://github.com/ToruNiina/toml11.git
synced 2025-09-18 10:28:09 +08:00
feat: extend has_from_toml_method to be generic
This commit is contained in:
@@ -60,13 +60,14 @@ struct has_resize_method_impl
|
|||||||
|
|
||||||
struct has_from_toml_method_impl
|
struct has_from_toml_method_impl
|
||||||
{
|
{
|
||||||
template<typename T>
|
template<typename T, typename C,
|
||||||
|
template<typename ...> class Tb, template<typename ...> class A>
|
||||||
static std::true_type check(
|
static std::true_type check(
|
||||||
decltype(std::declval<T>().from_toml(std::declval<::toml::basic_value<
|
decltype(std::declval<T>().from_toml(
|
||||||
::toml::discard_comments, std::unordered_map, std::vector>>()
|
std::declval<::toml::basic_value<C, Tb, A>>()))*);
|
||||||
)
|
|
||||||
)*);
|
template<typename T, typename C,
|
||||||
template<typename T>
|
template<typename ...> class Tb, template<typename ...> class A>
|
||||||
static std::false_type check(...);
|
static std::false_type check(...);
|
||||||
};
|
};
|
||||||
struct has_into_toml_method_impl
|
struct has_into_toml_method_impl
|
||||||
@@ -94,9 +95,11 @@ struct has_mapped_type : decltype(has_mapped_type_impl::check<T>(nullptr)){};
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
struct has_resize_method : decltype(has_resize_method_impl::check<T>(nullptr)){};
|
struct has_resize_method : decltype(has_resize_method_impl::check<T>(nullptr)){};
|
||||||
|
|
||||||
template<typename T>
|
template<typename T, typename C,
|
||||||
|
template<typename ...> class Tb, template<typename ...> class A>
|
||||||
struct has_from_toml_method
|
struct has_from_toml_method
|
||||||
: decltype(has_from_toml_method_impl::check<T>(nullptr)){};
|
: decltype(has_from_toml_method_impl::check<T, C, Tb, A>(nullptr)){};
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct has_into_toml_method
|
struct has_into_toml_method
|
||||||
: decltype(has_into_toml_method_impl::check<T>(nullptr)){};
|
: decltype(has_into_toml_method_impl::check<T>(nullptr)){};
|
||||||
|
Reference in New Issue
Block a user