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