ice_conversions_boost_templates.h
Go to the documentation of this file.
1#pragma once
2
3#include <map>
4
5#include <boost/container/flat_map.hpp>
6
7namespace armarx::armem
8{
9 // std::map <-> boost::container::flat_map
10
11 template <class IceKeyT, class IceValueT, class CppKeyT, class CppValueT>
12 void
13 toIce(std::map<IceKeyT, IceValueT>& iceMap,
14 const boost::container::flat_map<CppKeyT, CppValueT>& cppMap)
15 {
16 iceMap.clear();
17 for (const auto& [key, value] : cppMap)
18 {
19 iceMap.emplace(toIce<IceKeyT>(key), toIce<IceValueT>(value));
20 }
21 }
22
23 template <class IceKeyT, class IceValueT, class CppKeyT, class CppValueT>
24 void
25 fromIce(const std::map<IceKeyT, IceValueT>& iceMap,
26 boost::container::flat_map<CppKeyT, CppValueT>& cppMap)
27 {
28 cppMap.clear();
29 for (const auto& [key, value] : iceMap)
30 {
31 cppMap.emplace(fromIce<CppKeyT>(key), fromIce<CppValueT>(value));
32 }
33 }
34
35} // namespace armarx::armem
void fromIce(const data::MemoryID &ice, MemoryID &id)
void toIce(data::MemoryID &ice, const MemoryID &id)