OISEAU
A modern DGTD framework
Loading...
Searching...
No Matches
helper.hpp
1// Copyright (C) 2025 Tiago V. L. Amorim (@tiagovla)
2//
3// This file is part of oiseau (https://github.com/tiagovla/oiseau)
4//
5// SPDX-License-Identifier: GPL-3.0-or-later
6
7#pragma once
8#include <unordered_map>
9
10namespace oiseau::utils {
11template <typename K, typename V>
12std::unordered_map<V, K> reverse_map(const std::unordered_map<K, V> &m) {
13 std::unordered_map<V, K> r;
14 for (const auto &[k, v] : m) r[v] = k;
15 return r;
16}
17} // namespace oiseau::utils