Use ptr_vector
Hi!
Can anyone tell me why std::vector < boost::ptr_vector < T > > can not be reserved and resized I can not push_back anything inside vector, due to compile errors?
I am using ptr_vector for storing copyable, but nonassignable objects of type T - in fact objects contains mainly const elements.
Regards.
#include <iostream> #include <vector> #include
class Foo { public: Foo ( int const i, int const & j ) :i_(i), j_(j) {}
Foo ( Foo const & f ) : i_(f.i_), j_(f.j_) {}
private: int const i_; int const & j_; void operator= ( Foo const & f ); };
int main() { using namespace std; using namespace boost;
int k = 10; ptr_vector<Foo> g;
g.push_back ( new Foo(1,k) );
vector
d; //d.push_back ( g ); <-- Errors //d.resize(5) //d.reserve(5) } --
|\/\/| Seweryn Habdank-Wojewódzki \/\/ _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
-- Felipe Magno de Almeida