首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >邮箱进入SimGrid

邮箱进入SimGrid
EN

Stack Overflow用户
提问于 2021-05-16 18:09:28
回答 1查看 52关注 0票数 1

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

代码语言:javascript
复制
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 =my_mailbox->getstd::string()中;

错误:无法推断类型“auto”,也不允许输入名称

EN

回答 1

Stack Overflow用户

发布于 2021-05-19 14:40:50

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

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/67560043

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档