Is it possible to initialize a vector of vectors of non-copyable objects?
class obj : private boost::noncopyable {
// ...
};
vector<vector<obj> > v(10); // OK
for(int i = 0; i < v.size(); ++i)
v[i].resize(10); // ERROR
also
vector<vector<obj> > v(10, vector<obj>(10)); // ERROR
I understand why the above code won't compile. What I'm asking is whether there's a workaround. It seems that if std::vector
had a member function like resize_from_zero
that didn't need a copy constructor, then this would be doable.
(My question is about C++03, if this makes a difference)