я использую простой вектор push_back для объекта типа A и получаю эту ошибку, это мой код:
class A
{
public:
A(int a,int b,int c);
};
#include "A.h"
....
....
....
....
std::vector<A>* vec_objects = new std::vector<A>();
while(....some condition ...)
{
A a(1,2,3)
vec_objects->push_back(a);
}
получение этой ошибки:
c:\program files\microsoft visual studio 9.0\vc\include\xutility(3159) : error C2582: 'operator =' function is unavailable in 'A'
1> c:\program files\microsoft visual studio 9.0\vc\include\xutility(3187) : see reference to function template instantiation 'void std::_Fill<A*,_Ty>(_FwdIt,_FwdIt,const _Ty &)' being compiled
1> with
1> [
1> _Ty=A,
1> _FwdIt=A *
1> ]
1> c:\program files\microsoft visual studio 9.0\vc\include\vector(1231) : see reference to function template instantiation 'void std::fill<A*,_Ty>(_FwdIt,_FwdIt,const _Ty &)' being compiled
1> with
1> [
1> _Ty=A,
1> _FwdIt=A *
1> ]
1> c:\program files\microsoft visual studio 9.0\vc\include\vector(1153) : while compiling class template member function 'void std::vector<_Ty>::_Insert_n(std::_Vector_const_iterator<_Ty,_Alloc>,unsigned int,const _Ty &)'
1> with
1> [
1> _Ty=A,
1> _Alloc=std::allocator<A>
1> ]
1>
что я сделал не так?
A
константными? - person hmjd   schedule 03.07.2012push_back
, и мы не можем сказать, почему, когда вы этого не делаете. т показать определение. - person Jan Hudec   schedule 03.07.2012