我需要一些帮助,这样的类型不匹配怎么可能? 当我替换所有内容时,它的类型完全相同 常量性。
cgVertex3D.cpp:33: error: no matching function for call to
std::vector<Polygon3D*, std::allocator<Polygon3D*> >::push_back(const Polygon3D*&)
/usr/include/c++/4.4/bits/stl_vector.h:733:
note: candidates are:
void std::vector<_Tp, _Alloc>::push_back(const _Tp&)
[with _Tp = Polygon3D*, _Alloc = std::allocator<Polygon3D*>]
<near match>
答案 0 :(得分:6)
_Tp
是const
,在这种情况下_Tp
是指针。因此,const _Tp
的替换实际上会导致Polygon3D *const
,而不是const Polygon3D *
,因此不匹配。