2016-09-22 23:28:14 -07:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <unordered_map>
|
|
|
|
#include <unordered_set>
|
2016-11-06 20:11:50 -08:00
|
|
|
#include <map>
|
2016-09-22 23:28:14 -07:00
|
|
|
|
2017-01-05 12:47:08 -08:00
|
|
|
namespace vcpkg::Maps
|
2016-09-22 23:28:14 -07:00
|
|
|
{
|
|
|
|
template <typename K, typename V>
|
|
|
|
std::unordered_set<K> extract_key_set(const std::unordered_map<K, V>& input_map)
|
|
|
|
{
|
|
|
|
std::unordered_set<K> key_set;
|
|
|
|
for (auto const& element : input_map)
|
|
|
|
{
|
|
|
|
key_set.insert(element.first);
|
|
|
|
}
|
|
|
|
return key_set;
|
|
|
|
}
|
2016-11-02 19:33:11 -07:00
|
|
|
|
|
|
|
template <typename K, typename V>
|
|
|
|
std::vector<K> extract_keys(const std::unordered_map<K, V>& input_map)
|
|
|
|
{
|
|
|
|
std::vector<K> key_set;
|
|
|
|
for (auto const& element : input_map)
|
|
|
|
{
|
|
|
|
key_set.push_back(element.first);
|
|
|
|
}
|
|
|
|
return key_set;
|
|
|
|
}
|
2016-11-06 20:11:50 -08:00
|
|
|
|
|
|
|
template <typename K, typename V>
|
|
|
|
std::vector<K> extract_keys(const std::map<K, V>& input_map)
|
|
|
|
{
|
|
|
|
std::vector<K> key_set;
|
|
|
|
for (auto const& element : input_map)
|
|
|
|
{
|
|
|
|
key_set.push_back(element.first);
|
|
|
|
}
|
|
|
|
return key_set;
|
|
|
|
}
|
2017-01-05 12:47:08 -08:00
|
|
|
}
|