|
Boost Users : |
From: Josh Quigley (josh.quigley_at_[hidden])
Date: 2007-05-10 19:05:10
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_at_[hidden]
[mailto:boost-users-bounces_at_[hidden]] On Behalf Of Thorsten Ottosen
Sent: Friday, 11 May 2007 12:39 AM
To: boost-users_at_[hidden]
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_at_[hidden]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
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