struct Obj
{
Obj(P *p, int i): m_p(p), m_info(info) {}
std::auto_ptr<P> m_p;
int m_info;
};
std::vector<Obj> objects; // error C2558: struct 'Obj' : no copy constructor available...
The problem here resides in auto_ptr
, I guess. Everybody knows that it's a bad thing to push auto_ptr
into containers, and it's also a bad to push those who holds auto_ptr
into containers.
It I had no m_info
field, I would use boost::ptr_vector<P> objects
How would you suggest to sort it out?