|
Boost Users : |
From: Seweryn Habdank-Wojewódzki (shw_at_[hidden])
Date: 2007-05-25 19:57:58
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 <boost/ptr_container/ptr_vector.hpp>
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<ptr_vector<Foo> > d;
//d.push_back ( g ); <-- Errors
//d.resize(5)
//d.reserve(5)
}
-- |\/\/| Seweryn Habdank-Wojewódzki \/\/
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net