10 May
2007
10 May
'07
2:39 p.m.
Josh Quigley skrev:
Hello,
I’m trying to use boost::ptr_vector with constant members, like
// Excerpt 1
boost::ptr_vector<const int> myVector;
myVector.push_back(new int(5)); //This line fails, see comment below
myVector[1] = 7; //This should fail,
I haven't spent time trying to support ptr_container<const T>, so I don't know if the fix will be easy. I'll put it on my todo list though. Note that void foo( const ptr_vector<int>& vec ) { vec[1] = 7; } fails. I'm not sure I completely understand your analogy though: shared_ptr<T> and a ptr_vector<T> are not similar types; the former is a smart pointer, the latter a container. -Thorsten