|
Hyperiso 1.0.3
Modular flavour-physics calculations, Wilson coefficients and statistical inference
|
Generic utilities for bidirectional enum–string mappings. More...
#include <map>#include <string>#include <vector>

Go to the source code of this file.
Classes | |
| class | EnumMapperBase< Enum, Derived > |
| CRTP base class for enum–string mappers. More... | |
Functions | |
| template<typename K , typename V > | |
| std::map< V, K > | invert_map (const std::map< K, V > &original) |
| Builds the inverse of a std::map by swapping keys and values. | |
Generic utilities for bidirectional enum–string mappings.
This header provides:
A typical usage pattern is:
Definition in file EnumMapper.h.
Builds the inverse of a std::map by swapping keys and values.
Given an ordered map original of type std::map<K, V>, this helper constructs a new std::map<V, K> where each value becomes a key and each key becomes a value.
If multiple keys in original share the same value, the last one encountered in iteration order will overwrite the previous entry in the inverse map. This is intentional and tested behaviour.
| K | Key type of the original map. |
| V | Value type of the original map. |
| original | Map to invert. |
Definition at line 131 of file EnumMapper.h.