This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: unsafe STL patch
- From: Paolo Carlini <paolo dot carlini at oracle dot com>
- To: François Dumont <francois dot cppdevs at free dot fr>
- Cc: libstdc++ at gcc dot gnu dot org
- Date: Tue, 26 Jan 2010 22:18:34 +0100
- Subject: Re: unsafe STL patch
- References: <4B5F586C.7050905@free.fr>
Hi,
> Hello
>
> This is a patch proposition to:
> - Limit impact on STL safe mode on performance
> - Limit template method instanciation
>
> My point is that once an iterator range has been validated thanks
> to the check_valid_range or any similar function it is useless to keep
> the safe wrapper when passing it to the normal container
> implementation. Of course the safe wrapper can only be removed if the
> check_valid_range has been able to validate that begin is before end
> which is only possible for random access iterator.
The idea makes sense.
I think it's becoming rather clear that a mechanism like your __unsafe
is rather useful in general: in stl_algobase.h I'm guilty to have
duplicated it two times in __miter_base and __niter_base. Are you
willing to figure out first an abstraction for that?
> The patch is limited to the impact on the list safe implementation.
> If you find an interest in this patch I will generalize it to other
> safe containers, complete ChangeLog and perhaps fill a FSF form.
The conditional seems a bit strange to me: if the premise holds, then
the consequent should not have that <perhaps> in it ;)
Paolo.