首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >用hpx::数据流和成员函数编译错误

用hpx::数据流和成员函数编译错误
EN

Stack Overflow用户
提问于 2019-01-27 16:56:27
回答 1查看 93关注 0票数 0

使用成员函数调用hpx::dataflow的正确方法是什么?

hpx::async工作得很好,但是我们不知道为什么hpx::dataflow不编译。

代码语言:javascript
复制
#include <hpx/hpx_main.hpp>
#include <hpx/hpx.hpp>
#include <memory>

class A {
public:
  A& do_work(double x, const A& y, const A& z) {
    i = x + y.i + z.i;
    return *this;
  }

  double i = 1.0;
};

int main() {
  // Create instances
  std::vector<std::unique_ptr<A>> vec;
  for (int i = 0; i < 3; ++i) {
    vec.emplace_back( std::make_unique<A>() );
  }

  std::vector<hpx::shared_future<A&>> a1(3);
  std::vector<hpx::shared_future<A&>> a2(3);

  // works
  a1[1] = hpx::async( &A::do_work, vec[1].get(), 1.0, *vec[0], *vec[2] );

  // compiler error here
  a2[1] = hpx::dataflow( hpx::util::unwrapping_all( &A::do_work ),
            vec[1].get(), 2.0, a1[0], a2[0] );

  return 0;
}

编译器错误显示:

代码语言:javascript
复制
hpx.cpp:29:100:   required from here
.../hpx/hpx/traits/get_remote_result.hpp:25:20: error: invalid cast from type ‘std::remove_reference<A&>::type’ {aka
‘A’} to type ‘A*’ return Result(std::move(rhs));

使用的HPX版本为1.2.0,GCC 8.1。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-01-30 22:34:37

在我看来这是个窃听器。我在存储库上创建了一个问题:https://github.com/STEllAR-GROUP/hpx/issues/3639

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

https://stackoverflow.com/questions/54390555

复制
相关文章

相似问题

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