Thanks, that is the answer I was after (I now know I wasn't doing anything wrong). As for the analogy, I only wanted to show the behavior of recovering a const pointer. -----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Thorsten Ottosen Sent: Friday, 11 May 2007 12:39 AM To: boost-users@lists.boost.org Subject: Re: [Boost-users] boost::ptr_vector with const members 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 _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users