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 
8 
9 namespace armarx
10 {
11  // std::map <-> boost::container::flat_map
12 
13  template <class IceKeyT, class IceValueT, class CppKeyT, class CppValueT>
14  void
15  toIce(std::map<IceKeyT, IceValueT>& iceMap,
16  const boost::container::flat_map<CppKeyT, CppValueT>& cppMap)
17  {
18  iceMap.clear();
19  for (const auto& [key, value] : cppMap)
20  {
21  iceMap.emplace(toIce<IceKeyT>(key), toIce<IceValueT>(value));
22  }
23  }
24 
25  template <class IceKeyT, class IceValueT, class CppKeyT, class CppValueT>
26  void
27  fromIce(const std::map<IceKeyT, IceValueT>& iceMap,
28  boost::container::flat_map<CppKeyT, CppValueT>& cppMap)
29  {
30  cppMap.clear();
31  for (const auto& [key, value] : iceMap)
32  {
33  cppMap.emplace(fromIce<CppKeyT>(key), fromIce<CppValueT>(value));
34  }
35  }
36 
37 } // namespace armarx
armarx::toIce
void toIce(std::map< IceKeyT, IceValueT > &iceMap, const boost::container::flat_map< CppKeyT, CppValueT > &cppMap)
Definition: ice_conversions_boost_templates.h:15
cxxopts::value
std::shared_ptr< Value > value()
Definition: cxxopts.hpp:855
armarx::fromIce
void fromIce(const std::map< IceKeyT, IceValueT > &iceMap, boost::container::flat_map< CppKeyT, CppValueT > &cppMap)
Definition: ice_conversions_boost_templates.h:27
ice_conversions_templates.h
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:27