Update get.hpp

This commit is contained in:
Evan
2025-03-30 09:26:36 -07:00
committed by GitHub
parent 2da6f0edcf
commit a0cda88c6c

View File

@@ -398,6 +398,25 @@ get(const basic_value<TC>& v)
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 = T;
const auto& a = v.as_array();
std::unordered_set<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.