mirror of
https://github.com/ToruNiina/toml11.git
synced 2025-12-16 03:08:52 +08:00
feat [skip ci]: update single_include
This commit is contained in:
@@ -3653,6 +3653,7 @@ struct from;
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <tuple>
|
#include <tuple>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
#include <unordered_set>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#if defined(TOML11_HAS_STRING_VIEW)
|
#if defined(TOML11_HAS_STRING_VIEW)
|
||||||
@@ -3807,6 +3808,12 @@ struct is_std_tuple_impl<std::tuple<Ts...>> : std::true_type{};
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
using is_std_tuple = is_std_tuple_impl<cxx::remove_cvref_t<T>>;
|
using is_std_tuple = is_std_tuple_impl<cxx::remove_cvref_t<T>>;
|
||||||
|
|
||||||
|
template<typename T> struct is_unordered_set_impl : std::false_type {};
|
||||||
|
template<typename T>
|
||||||
|
struct is_unordered_set_impl<std::unordered_set<T>> : std::true_type {};
|
||||||
|
template<typename T>
|
||||||
|
using is_unordered_set = is_unordered_set_impl<cxx::remove_cvref_t<T>>;
|
||||||
|
|
||||||
#if defined(TOML11_HAS_OPTIONAL)
|
#if defined(TOML11_HAS_OPTIONAL)
|
||||||
template<typename T> struct is_std_optional_impl : std::false_type{};
|
template<typename T> struct is_std_optional_impl : std::false_type{};
|
||||||
template<typename T>
|
template<typename T>
|
||||||
@@ -9227,6 +9234,25 @@ get(const basic_value<TC>& v)
|
|||||||
cxx::make_index_sequence<std::tuple_size<T>::value>{});
|
cxx::make_index_sequence<std::tuple_size<T>::value>{});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
// std::unordered_set
|
||||||
|
|
||||||
|
template<typename T, typename TC>
|
||||||
|
cxx::enable_if_t<toml::detail::is_unordered_set<T>::value, T>
|
||||||
|
get(const basic_value<TC>& v)
|
||||||
|
{
|
||||||
|
using value_type = typename T::value_type;
|
||||||
|
const auto& a = v.as_array();
|
||||||
|
|
||||||
|
T container;
|
||||||
|
for (const auto& elem : a)
|
||||||
|
{
|
||||||
|
container.insert(get<value_type>(elem));
|
||||||
|
}
|
||||||
|
return container;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// map-like types; most likely STL map, like std::map or std::unordered_map.
|
// map-like types; most likely STL map, like std::map or std::unordered_map.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user