mirror of
https://github.com/ToruNiina/toml11.git
synced 2025-09-18 02:08:09 +08:00
Merge branch 'master' into v3
This commit is contained in:
19
toml/get.hpp
19
toml/get.hpp
@@ -702,10 +702,13 @@ get_or(const basic_value<C, M, V>& v, T&& opt)
|
||||
template<typename T, typename C,
|
||||
template<typename ...> class M, template<typename ...> class V>
|
||||
detail::enable_if_t<detail::conjunction<
|
||||
detail::negation<detail::is_exact_toml_type<T, basic_value<C, M, V>>>,
|
||||
detail::negation<detail::is_exact_toml_type<
|
||||
typename std::remove_cv<typename std::remove_reference<T>::type>::type,
|
||||
basic_value<C, M, V>>>,
|
||||
detail::negation<std::is_same<std::string,
|
||||
typename std::remove_cv<typename std::remove_reference<T>::type>::type>>,
|
||||
detail::negation<detail::is_string_literal<typename std::remove_reference<T>::type>>
|
||||
detail::negation<detail::is_string_literal<
|
||||
typename std::remove_reference<T>::type>>
|
||||
>::value, typename std::remove_reference<T>::type>
|
||||
get_or(const basic_value<C, M, V>& v, T&& opt)
|
||||
{
|
||||
@@ -790,7 +793,7 @@ detail::enable_if_t<std::is_same<T, std::string>::value, std::string>
|
||||
find_or(basic_value<C, M, V>&& v, const toml::key& ky, T&& opt)
|
||||
{
|
||||
if(!v.is_table()) {return std::forward<T>(opt);}
|
||||
auto tab = toml::get<toml::table>(std::move(v));
|
||||
auto tab = std::move(v).as_table();
|
||||
if(tab.count(ky) == 0) {return std::forward<T>(opt);}
|
||||
return get_or(std::move(tab.at(ky)), std::forward<T>(opt));
|
||||
}
|
||||
@@ -815,9 +818,13 @@ find_or(const basic_value<C, M, V>& v, const toml::key& ky, T&& opt)
|
||||
template<typename T, typename C,
|
||||
template<typename ...> class M, template<typename ...> class V>
|
||||
detail::enable_if_t<detail::conjunction<
|
||||
detail::negation<detail::is_exact_toml_type<T, basic_value<C, M, V>>>,
|
||||
detail::negation<std::is_same<T, std::string>>,
|
||||
detail::negation<detail::is_string_literal<typename std::remove_reference<T>::type>>
|
||||
detail::negation<detail::is_exact_toml_type<
|
||||
typename std::remove_cv<typename std::remove_reference<T>::type>::type,
|
||||
basic_value<C, M, V>>>,
|
||||
detail::negation<std::is_same<std::string,
|
||||
typename std::remove_cv<typename std::remove_reference<T>::type>::type>>,
|
||||
detail::negation<detail::is_string_literal<
|
||||
typename std::remove_reference<T>::type>>
|
||||
>::value, T>
|
||||
find_or(const basic_value<C, M, V>& v, const toml::key& ky, T&& opt)
|
||||
{
|
||||
|
Reference in New Issue
Block a user