11#include <boost/container/flat_map.hpp>
14namespace ActsExamples {
20using Index = uint32_t;
27template <
typename value_t>
28using IndexMultimap = boost::container::flat_multimap<Index, value_t>;
35template <
typename value_t>
36inline boost::container::flat_multimap<value_t, Index> invertIndexMultimap(
37 const IndexMultimap<value_t>& multimap) {
38 using InverseMultimap = boost::container::flat_multimap<value_t, Index>;
41 typename InverseMultimap::sequence_type unordered;
42 unordered.reserve(multimap.size());
43 for (
auto&& [index, value] : multimap) {
45 unordered.emplace_back(value, index);
49 InverseMultimap inverse;
50 inverse.insert(unordered.begin(), unordered.end());