- char* key;
- char* ptr_rank;
- xbt_dict_cursor_t cursor = nullptr;
- xbt_dict_foreach(origin->index_to_rank_map_, cursor, key, ptr_rank) {
- int * cp = static_cast<int*>(xbt_malloc(sizeof(int)));
- *cp=*reinterpret_cast<int*>(ptr_rank);
- xbt_dict_set(index_to_rank_map_, key, cp, nullptr);
- }
+ for (auto const& elm : origin->index_to_rank_map_) {
+ index_to_rank_map_.insert({elm.first, elm.second});