mirror of
https://github.com/BotChain-Robots/control.git
synced 2026-03-10 00:32:26 +01:00
Prepare files for public release
This commit is contained in:
18
include/util/Map.h
Normal file
18
include/util/Map.h
Normal file
@@ -0,0 +1,18 @@
|
||||
|
||||
#ifndef CONTROL_MAP_H
|
||||
#define CONTROL_MAP_H
|
||||
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
template <typename K, typename V, typename H>
|
||||
std::vector<V> map_to_values(const std::unordered_map<K, V, H> &map) {
|
||||
std::vector<V> out;
|
||||
out.reserve(map.size());
|
||||
for (auto const &[key, value] : map) {
|
||||
out.push_back(value);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
#endif // CONTROL_MAP_H
|
||||
Reference in New Issue
Block a user