mirror of
https://github.com/ToruNiina/toml11.git
synced 2025-09-17 00:38:08 +08:00
refactor: use has_specialized_from<T>
to check if toml::from<T> exists for a specific T
This commit is contained in:
12
toml/get.hpp
12
toml/get.hpp
@@ -255,9 +255,9 @@ get(const basic_value<C, M, V>&);
|
|||||||
|
|
||||||
// toml::from<T>::from_toml(v)
|
// toml::from<T>::from_toml(v)
|
||||||
template<typename T, typename C,
|
template<typename T, typename C,
|
||||||
template<typename ...> class M, template<typename ...> class V,
|
template<typename ...> class M, template<typename ...> class V>
|
||||||
std::size_t S = sizeof(::toml::from<T>)>
|
detail::enable_if_t<detail::has_specialized_from<T>::value, T>
|
||||||
T get(const basic_value<C, M, V>&);
|
get(const basic_value<C, M, V>&);
|
||||||
|
|
||||||
// T(const toml::value&) and T is not toml::basic_value
|
// T(const toml::value&) and T is not toml::basic_value
|
||||||
template<typename T, typename C,
|
template<typename T, typename C,
|
||||||
@@ -440,9 +440,9 @@ get(const basic_value<C, M, V>& v)
|
|||||||
return ud;
|
return ud;
|
||||||
}
|
}
|
||||||
template<typename T, typename C,
|
template<typename T, typename C,
|
||||||
template<typename ...> class M, template<typename ...> class V,
|
template<typename ...> class M, template<typename ...> class V>
|
||||||
std::size_t>
|
detail::enable_if_t<detail::has_specialized_from<T>::value, T>
|
||||||
T get(const basic_value<C, M, V>& v)
|
get(const basic_value<C, M, V>& v)
|
||||||
{
|
{
|
||||||
return ::toml::from<T>::from_toml(v);
|
return ::toml::from<T>::from_toml(v);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user