feat [skip ci]: update single_include

This commit is contained in:
ToruNiina
2025-01-18 08:23:45 +00:00
parent 9251741189
commit c87bdaaeea

View File

@@ -9671,6 +9671,37 @@ T find_or(const basic_value<TC>& v, const K1& k1, const K2& k2, const K3& k3, co
}
}
// ===========================================================================
// find_or_default<T>(value, key)
template<typename T, typename TC, typename K>
cxx::enable_if_t<std::is_default_constructible<T>::value, T>
find_or_default(const basic_value<TC>& v, K&& k) noexcept(std::is_nothrow_default_constructible<T>::value)
{
try
{
return ::toml::get<T>(v.at(detail::key_cast<TC>(std::forward<K>(k))));
}
catch(...)
{
return T();
}
}
template<typename T, typename TC, typename K1, typename ... Ks>
cxx::enable_if_t<std::is_default_constructible<T>::value, T>
find_or_default(const basic_value<TC>& v, K1&& k1, Ks&& ... keys) noexcept(std::is_nothrow_default_constructible<T>::value)
{
try
{
return find_or_default<T>(v.at(std::forward<K1>(k1)), std::forward<Ks>(keys)...);
}
catch(...)
{
return T();
}
}
} // toml
#endif // TOML11_FIND_HPP
#ifndef TOML11_CONVERSION_HPP