邮箱进入SimGrid

Mailbox get in SimGrid

本文关键字:SimGrid      更新时间:2024-09-22

我正在研究simgrid中的邮箱,查看文档中的示例,但当我试图编译示例时,会出现错误,主要是在邮箱中->收到我将把代码片段放在下面。

if (rank == 0) {
/* The root actor (rank 0) first sends the token then waits to receive it back */
XBT_INFO("Host "%u" send 'Token' to Host "%s"", rank, neighbor_mailbox->get_cname());
std::string msg = "Token";
neighbor_mailbox->put(&msg, token_size);
const auto* res = my_mailbox->get<std::string>();
XBT_INFO("Host "%u" received "%s"", rank, res->c_str());
} else {
auto* res = my_mailbox->get<std::string>();
XBT_INFO("Host "%u" received "%s"", rank, res->c_str());
XBT_INFO("Host "%u" send 'Token' to Host "%s"", rank, neighbor_mailbox->get_cname());
neighbor_mailbox->put(res, token_size);
}

错误发生在const auto-res=my_mailbox->getstd::字符串((;

错误:无法推断类型"auto">并且不允许使用类型名称

const auto *res = static_cast<std::string*>(my_mailbox->get());替换auto* res = my_mailbox->get<std::string>();

相关文章:
  • 没有找到相关文章