6 #include <boost/unordered_map.hpp>
10 template <
typename T1>
13 for (
auto const&
x : map) {
14 dictionnary[
x.first] =
x.second;
19 template <
typename T1>
20 std::map<std::string, T1>
copy(
const std::map<std::string, T1>& map) {
21 std::map<std::string, T1> out = map;
25 template <
typename T1>
27 const boost::unordered_map<std::string, T1>& obj) {
41 std::string, double, std::less<std::string>,
42 std::allocator<std::pair<const std::string, double> >,
48 using StdMap_X = std::map<std::string, X>;
49 bp::class_<X>(
"X", bp::init<int>()).def_readwrite(
"val", &
X::val);
55 bp::def(
"std_map_to_dict", std_map_to_dict<double>);
56 bp::def(
"copy", copy<double>);
57 bp::def(
"copy_boost", copy_boost<int>);
58 bp::def(
"copy_X", +[](
const StdMap_X&
m) {
return m; });