gpt4 book ai didi

c++ - 错误 : ‘double’ is not a class, 结构或 union 类型

转载 作者:搜寻专家 更新时间:2023-10-31 01:49:10 24 4
gpt4 key购买 nike

<分区>

我遇到了这个问题,我收到了一段非常敏感的代码,它应该在嵌套 vector 中存储 70 个 x,y 坐标集,然后将其转换为 float 组;这是:

 vector<vector<vector<float> > > KnownPoints ;
float* returnPoint = new float[knownFaces.size()*70*2];
for(int i=0;i<KnownPoints.size();i++){
for(int k=0;k<KnownPoints[i].size();k++){
returnPoint[i*70*2+k*2] = KnownPoints[i][k][0];
returnPoint[i*70*2+k*2+1] = KnownPoints[i][k][1];
}
}

但我不断收到这些错误:

/usr/include/c++/4.7/bits/stl_vector.h:1147:24:   required from ‘void std::vector<_Tp, _Alloc>::_M_initialize_dispatch(_InputIterator, _InputIterator, std::__false_type) [with _InputIterator = double; _Tp = float; _Alloc = std::allocator<float>]’
/usr/include/c++/4.7/bits/stl_vector.h:393:4: required from ‘std::vector<_Tp, _Alloc>::vector(_InputIterator, _InputIterator, const allocator_type&) [with _InputIterator = double; _Tp = float; _Alloc = std::allocator<float>; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<float>]’
LibEmotion.cpp:69:47: required from here
/usr/include/c++/4.7/bits/stl_iterator_base_types.h:166:53: error: ‘double’ is not a class, struct, or union type
/usr/include/c++/4.7/bits/stl_iterator_base_types.h:167:53: error: ‘double’ is not a class, struct, or union type
/usr/include/c++/4.7/bits/stl_iterator_base_types.h:168:53: error: ‘double’ is not a class, struct, or union type
/usr/include/c++/4.7/bits/stl_iterator_base_types.h:169:53: error: ‘double’ is not a class, struct, or union type
/usr/include/c++/4.7/bits/stl_iterator_base_types.h:170:53: error: ‘double’ is not a class, struct, or union type

非常感谢您的帮助,胺


编辑1:这是我认为导致它的代码片段:

vector<cv::Point> pos;
vector<vector<float> > response;
for (int k = 0; k < pos.size(); k++) {
response[k+1] = {pos[k].x,pos[k].y};
}

谢谢

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com