Boost logo

Boost :

Subject: Re: [boost] [Pointer Container] Modification of pointer containers to allow const elements
From: Scott McMurray ([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, gregod at, cpdaniel at, john at