c++stl问题

来源:百度知道 编辑:UC知道 时间:2024/09/22 00:53:03
首先,vector可以存储自定义数据如类吗?
d:\学习\vc98\include\algorithm(583) : error C2784: 'bool __cdecl std::operator <(const class std::vector<_Ty,_A> &,const class std::vector<_Ty,_A> &)' : could not deduce template argument for 'const class std::vector<_Ty,_A> &' from 'class Pro'
d:\学习\vc98\include\algorithm(548) : see reference to function template instantiation 'void __cdecl std::_Unguarded_insert(class Pro *,class Pro)' being compiled
d:\学习\vc98\include\algorithm(583) : error C2784: 'bool __cdecl std::operator <(const class std::reverse_iterator<_RI,_Ty,_Rt,_Pt,_D> &,const class std::reverse_iterator<_RI,_Ty,_Rt,_Pt,_D> &)' : could not deduce template argument for 'const class
std::reverse_iterator<_RI,_Ty,_Rt,_Pt,_D> &' from 'class Pro'
d:\学习\vc98\include\algorithm(548) : see reference to functio

vector <Pro> mydata;
应该可以。
你是不是用了排序却没有定义 < 运算?

可以存储但是你什么地方写错了, 给错了类型了

stl的错误提示除了名的天书,想看什么错最好自习看看那的代码