diff options
Diffstat (limited to 'lib/hj/pyutils.h')
| -rw-r--r-- | lib/hj/pyutils.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/hj/pyutils.h b/lib/hj/pyutils.h index f7dafbf..f34c1d8 100644 --- a/lib/hj/pyutils.h +++ b/lib/hj/pyutils.h @@ -44,6 +44,14 @@ std::vector<T> keys(std::unordered_map<T, X> const &map) { } return result; } +template<typename T, typename X> +std::vector<T> keys(std::map<T, X> const &map) { + std::vector<T> result; + for (auto const &pair: map) { + result.push_back(pair.first); + } + return result; +} } template <typename T> |
