- smx_mailbox_t mbox = static_cast<smx_mailbox_t>(xbt_dict_get_or_null(mailboxes, name));
- if (not mbox) {
- mbox = new MailboxImpl(name);
- XBT_DEBUG("Creating a mailbox at %p with name %s", mbox, name);
- xbt_dict_set(mailboxes, mbox->name_, mbox, nullptr);
- }
- return mbox;
+ auto m = mailboxes->find(name);
+ if (m == mailboxes->end()) {
+ smx_mailbox_t mbox = new MailboxImpl(name);
+ XBT_DEBUG("Creating a mailbox at %p with name %s", mbox, name.c_str());
+ (*mailboxes)[mbox->name_] = mbox;
+ return mbox;
+ } else
+ return m->second;