Boost logo

Boost :

Subject: Re: [boost] [Pointer Container] Modification of pointer containers to allow const elements
From: Scott McMurray (me22.ca+boost_at_[hidden])
Date: 2010-10-14 20:38:28


2010/10/14 Gerardo Hernández <g.hernandez_at_[hidden]>:
>
> The problem is that the underlying type of boost::ptr_vector<T> is
> always vector<void*>, no matter T is const.
>

Since the point of this is to only ever instantiate one version of the
underlying container, wouldn't it be better to always use
underlying_container<void const*>, then const_cast when returning to
the user?

Since we know we had a pointer to non-const at some point, the
const_casts would all be legal, afaik. (const_cast atop an
underlying_container<void*> would not be.)

~ Scott


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk