为什么我会在此 omp_declare_reduction 中收到此错误?

你好世界

我有这个文件:

struct B;

struct A
{
    A(... B &b) :
        b(b) {}

    B &b;
};

Bh

#include "A.h"
struct B{
...
std::vector<A> as;
}

我有这个omp_declare_reduction

#pragma omp declare reduction(merge : B : omp_out.as.insert(omp_out.as.end(), omp_in.as.begin(), omp_in.as.end()))

但是,我收到此错误( whereA=FindAffineShapeArgsB=Wrapper):

/usr/include/c++/5/bits/stl_algobase.h(564): error: function "FindAffineShapeArgs::operator=(const FindAffineShapeArgs &)" (declared implicitly) cannot be referenced -- it is a deleted function
        *--__result = std::move(*--__last);
                    ^
          detected during:
            instantiation of "_BI2 std::__copy_move_backward<true, false, std::random_access_iterator_tag>::__copy_move_b(_BI1, _BI1, _BI2) [with _BI1=FindAffineShapeArgs *, _BI2=FindAffineShapeArgs *]" at line 606
            instantiation of "_BI2 std::__copy_move_backward_a<_IsMove,_BI1,_BI2>(_BI1, _BI1, _BI2) [with _IsMove=true, _BI1=FindAffineShapeArgs *, _BI2=FindAffineShapeArgs *]" at line 615
            instantiation of "_BI2 std::__copy_move_backward_a2<_IsMove,_BI1,_BI2>(_BI1, _BI1, _BI2) [with _IsMove=true, _BI1=FindAffineShapeArgs *, _BI2=FindAffineShapeArgs *]" at line 686
            instantiation of "_BI2 std::move_backward(_BI1, _BI1, _BI2) [with _BI1=FindAffineShapeArgs *, _BI2=FindAffineShapeArgs *]" at line 636 of "/usr/include/c++/5/bits/vector.tcc"
            instantiation of "void std::vector<_Tp, _Alloc>::_M_range_insert(std::vector<_Tp, _Alloc>::iterator, _ForwardIterator, _ForwardIterator, std::forward_iterator_tag) [with _Tp=FindAffineShapeArgs, _Alloc=std::allocator<FindAffineShapeArgs>, _ForwardIterator=__gnu_cxx::__normal_iterator<FindAffineShapeArgs *, std::vector<FindAffineShapeArgs, std::allocator<FindAffineShapeArgs>>>]" at line 1377 of "/usr/include/c++/5/bits/stl_vector.h"
            instantiation of "void std::vector<_Tp, _Alloc>::_M_insert_dispatch(std::vector<_Tp, _Alloc>::iterator, _InputIterator, _InputIterator, std::__false_type) [with _Tp=FindAffineShapeArgs, _Alloc=std::allocator<FindAffineShapeArgs>, _InputIterator=__gnu_cxx::__normal_iterator<FindAffineShapeArgs *, std::vector<FindAffineShapeArgs, std::allocator<FindAffineShapeArgs>>>]" at line 1100 of "/usr/include/c++/5/bits/stl_vector.h"
            instantiation of "std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(std::vector<_Tp, _Alloc>::const_iterator, _InputIterator, _InputIterator) [with _Tp=FindAffineShapeArgs, _Alloc=std::allocator<FindAffineShapeArgs>, _InputIterator=__gnu_cxx::__normal_iterator<FindAffineShapeArgs *, std::vector<FindAffineShapeArgs, std::allocator<FindAffineShapeArgs>>>, <unnamed>=void]" at line 345 of
                      "/home/luca/Dropbox/HKUST/CloudCache/cloudcache/CloudCache/Descriptors/hesaff/pyramid.cpp"

    /usr/include/c++/5/bits/stl_algobase.h(340): error: function "FindAffineShapeArgs::operator=(const FindAffineShapeArgs &)" (declared implicitly) cannot be referenced -- it is a deleted function
              *__result = *__first;
                        ^
              detected during:
                instantiation of "_OI std::__copy_move<false, false, std::random_access_iterator_tag>::__copy_m(_II, _II, _OI) [with _II=FindAffineShapeArgs *, _OI=FindAffineShapeArgs *]" at line 402
                instantiation of "_OI std::__copy_move_a<_IsMove,_II,_OI>(_II, _II, _OI) [with _IsMove=false, _II=FindAffineShapeArgs *, _OI=FindAffineShapeArgs *]" at line 440
                instantiation of "_OI std::__copy_move_a2<_IsMove,_II,_OI>(_II, _II, _OI) [with _IsMove=false, _II=__gnu_cxx::__normal_iterator<FindAffineShapeArgs *, std::vector<FindAffineShapeArgs, std::allocator<FindAffineShapeArgs>>>, _OI=__gnu_cxx::__normal_iterator<FindAffineShapeArgs *, std::vector<FindAffineShapeArgs, std::allocator<FindAffineShapeArgs>>>]" at line 472
                instantiation of "_OI std::copy(_II, _II, _OI) [with _II=__gnu_cxx::__normal_iterator<FindAffineShapeArgs *, std::vector<FindAffineShapeArgs, std::allocator<FindAffineShapeArgs>>>, _OI=__gnu_cxx::__normal_iterator<FindAffineShapeArgs *, std::vector<FindAffineShapeArgs, std::allocator<FindAffineShapeArgs>>>]" at line 637 of "/usr/include/c++/5/bits/vector.tcc"
                instantiation of "void std::vector<_Tp, _Alloc>::_M_range_insert(std::vector<_Tp, _Alloc>::iterator, _ForwardIterator, _ForwardIterator, std::forward_iterator_tag) [with _Tp=FindAffineShapeArgs, _Alloc=std::allocator<FindAffineShapeArgs>, _ForwardIterator=__gnu_cxx::__normal_iterator<FindAffineShapeArgs *, std::vector<FindAffineShapeArgs, std::allocator<FindAffineShapeArgs>>>]" at line 1377 of "/usr/include/c++/5/bits/stl_vector.h"
                instantiation of "void std::vector<_Tp, _Alloc>::_M_insert_dispatch(std::vector<_Tp, _Alloc>::iterator, _InputIterator, _InputIterator, std::__false_type) [with _Tp=FindAffineShapeArgs, _Alloc=std::allocator<FindAffineShapeArgs>, _InputIterator=__gnu_cxx::__normal_iterator<FindAffineShapeArgs *, std::vector<FindAffineShapeArgs, std::allocator<FindAffineShapeArgs>>>]" at line 1100 of "/usr/include/c++/5/bits/stl_vector.h"
                instantiation of "std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(std::vector<_Tp, _Alloc>::const_iterator, _InputIterator, _InputIterator) [with _Tp=FindAffineShapeArgs, _Alloc=std::allocator<FindAffineShapeArgs>, _InputIterator=__gnu_cxx::__normal_iterator<FindAffineShapeArgs *, std::vector<FindAffineShapeArgs, std::allocator<FindAffineShapeArgs>>>, <unnamed>=void]" at line 345 of
                          "/home/luca/Dropbox/HKUST/CloudCache/cloudcache/CloudCache/Descriptors/hesaff/pyramid.cpp"

    compilation aborted for /home/luca/Dropbox/HKUST/CloudCache/cloudcache/CloudCache/Descriptors/hesaff/pyramid.cpp (code 2)

为什么会发生这种情况?这可能与有关,但适用于不同的情况。

萨姆·瓦尔沙夫奇克

这与 omp 或明显的循环引用无关(这里的循环引用本身没有任何问题)。你会得到一个类似的编译错误:

#include <vector>

struct B {};

struct A
{
    A(B &b) :
        b(b) {}

    B &b;
};


B b;
A a{b}, aa{b};

void foo()
{
        a=aa;
}

在这种情况下,gcc 错误的消息将为您指明线索:

t.C:19:4: error: use of deleted function ‘A& A::operator=(const A&)’

包含引用的类没有默认赋值运算符。这是因为引用不能在传统意义上被更改或“分配给”。

您正在创建一个std::vector,它需要根据需要复制/移动其值。但是向量的类包含一个引用成员,它从高轨道上破坏了类的赋值运算符。

为了实现这一点,您需要为类定义自己的赋值运算符和/或复制构造函数A,并让它们执行您需要它们执行的操作。

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

为什么我会在 Python 中收到此语法错误?

来自分类Dev

为什么我会在此代码中收到分段转储错误?

来自分类Dev

分段错误 - 为什么我会收到此错误?

来自分类Dev

为什么我会从WinLess收到此错误消息?

来自分类Dev

为什么我会收到此错误

来自分类Dev

为什么我会从WinLess收到此错误消息?

来自分类Dev

为什么我会收到此错误窗口表格?

来自分类Dev

为什么我会收到此错误 (NoMethodError)

来自分类Dev

为什么我会收到此错误?

来自分类Dev

为什么我会收到此错误:ActiveRecord::AssociationTypeMismatch?

来自分类Dev

为什么我在简单的angularjs程序中收到此错误?

来自分类Dev

为什么我在PL / SQL中收到此错误

来自分类Dev

为什么我在 angularJS 中收到此错误 Unknown provider?

来自分类Dev

为什么我在 facenet 中收到此错误?

来自分类Dev

为什么我在 Speech to text 代码中收到此错误?

来自分类Dev

为什么我会在 Swift 中收到有关段的文档引用错误?

来自分类Dev

我收到此错误

来自分类Dev

我不明白为什么我会在ts-jest和sequelize中遇到此错误

来自分类Dev

我不明白为什么我会收到此错误

来自分类Dev

为什么我收到此sql错误?

来自分类Dev

为什么我收到此错误 TemplateDoesNotExist?

来自分类Dev

为什么我会在传单中从左到右冲突方向?

来自分类Dev

为什么我会收到此 Webpack 加载程序错误?

来自分类Dev

为什么我会收到此错误“NameError:name 'self' 未定义。”

来自分类Dev

为什么我会收到此 Cloud Firestore 函数错误?

来自分类Dev

即使在初始化之后,为什么我会收到此错误?

来自分类Dev

为什么我会收到此类的“缺少 1 个位置参数”错误?

来自分类Dev

为什么我会在 Ubuntu 12.04 Live CD 会话期间收到“重复源”错误消息?

来自分类Dev

为什么我会收到此程序的“ValueError”消息?

Related 相关文章

  1. 1

    为什么我会在 Python 中收到此语法错误?

  2. 2

    为什么我会在此代码中收到分段转储错误?

  3. 3

    分段错误 - 为什么我会收到此错误?

  4. 4

    为什么我会从WinLess收到此错误消息?

  5. 5

    为什么我会收到此错误

  6. 6

    为什么我会从WinLess收到此错误消息?

  7. 7

    为什么我会收到此错误窗口表格?

  8. 8

    为什么我会收到此错误 (NoMethodError)

  9. 9

    为什么我会收到此错误?

  10. 10

    为什么我会收到此错误:ActiveRecord::AssociationTypeMismatch?

  11. 11

    为什么我在简单的angularjs程序中收到此错误?

  12. 12

    为什么我在PL / SQL中收到此错误

  13. 13

    为什么我在 angularJS 中收到此错误 Unknown provider?

  14. 14

    为什么我在 facenet 中收到此错误?

  15. 15

    为什么我在 Speech to text 代码中收到此错误?

  16. 16

    为什么我会在 Swift 中收到有关段的文档引用错误?

  17. 17

    我收到此错误

  18. 18

    我不明白为什么我会在ts-jest和sequelize中遇到此错误

  19. 19

    我不明白为什么我会收到此错误

  20. 20

    为什么我收到此sql错误?

  21. 21

    为什么我收到此错误 TemplateDoesNotExist?

  22. 22

    为什么我会在传单中从左到右冲突方向?

  23. 23

    为什么我会收到此 Webpack 加载程序错误?

  24. 24

    为什么我会收到此错误“NameError:name 'self' 未定义。”

  25. 25

    为什么我会收到此 Cloud Firestore 函数错误?

  26. 26

    即使在初始化之后,为什么我会收到此错误?

  27. 27

    为什么我会收到此类的“缺少 1 个位置参数”错误?

  28. 28

    为什么我会在 Ubuntu 12.04 Live CD 会话期间收到“重复源”错误消息?

  29. 29

    为什么我会收到此程序的“ValueError”消息?

热门标签

归档