This is the mail archive of the
libstdc++@gcc.gnu.org
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 10:10:11 +0100
- Subject: Re: [Patch] PR11504: -Wcast-qual and general constness issues with stl_tree.h
- References: <3F2037F7.3040303@free.fr>
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
> 2. The "const" typedefs.
> Why do I have to define "const" versions of the typedefs?
> If I have "typedef _Rb_tree_node* _Link_type;" then why can't I
> use "const _Link_type" instead of having to define an explicit
> const typedef like "typedef const _Rb_tree_node* _const_Link_type;"?
Because "const _Link_type" is the same as "_Link_type const" which is
"_Rb_tree_node* const" which is a const-pointer to a non-const-node,
not a pointer to a const-node.
Now repeat that six times as fast as you can! :-)
jon
--
"Once, during Prohibition, I was forced to live for days on nothing but
food and water."
- W.C. Fields