Skip to content
Snippets Groups Projects
Commit 3e760fdf authored by Rainer Kartmann's avatar Rainer Kartmann
Browse files

Fix get_keys for non-movable/copyable types

parent e2f8e752
No related branches found
No related tags found
No related merge requests found
......@@ -10,20 +10,10 @@
namespace simox::alg
{
namespace detail
{
auto key_type(auto&& c)
{
auto [k, v] = *c.begin();
return k;
}
}
/// Get the keys of an associative container, a vector of key-value pairs, ...
auto get_keys(const auto& map)
template <class K, class V, template<class...> class MapT = std::map, class...Ts>
std::vector<K> get_keys(const MapT<K, V, Ts...>& map)
{
using K = decltype(detail::key_type(map));
std::vector<K> keys;
keys.reserve(map.size());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment