This is the mail archive of the
mailing list for the libstdc++ project.
Re: [Patch] PR11504: -Wcast-qual and general constness issues with stl_tree.h
- From: Jonathan Wakely <cow at compsoc dot man dot ac dot uk>
- To: gp dot bolton at computer dot org
- Cc: libstdc++ at gcc dot gnu dot org
- Date: Fri, 25 Jul 2003 13:18:42 +0100
- Subject: Re: [Patch] PR11504: -Wcast-qual and general constness issues with stl_tree.h
- References: <3F2037F7.firstname.lastname@example.org> <20030725091011.GC21465@compsoc.man.ac.uk>
On Fri, Jul 25, 2003 at 10:10:11AM +0100, Jonathan Wakely wrote:
> On Thu, Jul 24, 2003 at 09:48:07PM +0200, Gawain Bolton wrote:
> > 1. I do not like the lack of symmetry with the casts for const vs.
> > non-const functions.
> > Non-const versions often require a reinterpret_cast whereas const
> > versions can use static_cast.
> Can't you combine const_cast and static_cast to achieve the same thing?
> As in http://gcc.gnu.org/ml/libstdc++/2003-07/msg00297.html
[replying to myself]
hmm, no. for example _M_root() wants to return a non-const reference,
which can't be bound to the rvalue that static_cast returns.
The old parser didn't seem to mind this (or at least, versions <= 3.2)
but 3.4 won't allow it.
"UNIX was not designed to stop you from doing stupid things,
because that would also stop you from doing clever things."
- Doug Gwyn