Skip to content
Snippets Groups Projects
Commit 08fbf9fb authored by Rainer Kartmann's avatar Rainer Kartmann
Browse files

Add toIce/fromIce for boost::container_flat_map (not used atm)

parent d7aa910e
No related branches found
No related tags found
2 merge requests!185Clean up interfaces and unneeded code in memory core classes,!178Draft: Make RobotStateMemory ready
......@@ -139,6 +139,7 @@ set(LIB_HEADERS
core/aron_conversions.h
core/json_conversions.h
core/ice_conversions.h
core/ice_conversions_boost_templates.h
core/ice_conversions_templates.h
core/error.h
......
#pragma once
#include <map>
#include <boost/container/flat_map.hpp>
namespace armarx::armem
{
// std::map <-> boost::container::flat_map
template <class IceKeyT, class IceValueT, class CppKeyT, class CppValueT>
void toIce(std::map<IceKeyT, IceValueT>& iceMap,
const boost::container::flat_map<CppKeyT, CppValueT>& cppMap)
{
iceMap.clear();
for (const auto& [key, value] : cppMap)
{
iceMap.emplace(toIce<IceKeyT>(key), toIce<IceValueT>(value));
}
}
template <class IceKeyT, class IceValueT, class CppKeyT, class CppValueT>
void fromIce(const std::map<IceKeyT, IceValueT>& iceMap,
boost::container::flat_map<CppKeyT, CppValueT>& cppMap)
{
cppMap.clear();
for (const auto& [key, value] : iceMap)
{
cppMap.emplace(fromIce<CppKeyT>(key), fromIce<CppValueT>(value));
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment