This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [RFC] On the uses of less<>() in basic_string
Bo Persson writes:
>
> ----- Original Message -----
> From: "Paolo Carlini" <pcarlini@suse.de>
> To: "Bo Persson" <bop@gmb.dk>
> Cc: "libstdc++" <libstdc++@gcc.gnu.org>
> Sent: Wednesday, February 04, 2004 6:24 PM
> Subject: Re: [RFC] On the uses of less<>() in basic_string
>
>
> > Bo Persson wrote:
> >
> > > No peeking! :-)
> > >
> > > How do you know that traits::copy uses memcpy? That is an implementation
> > > detail that is specifically delegated to char_traits, so that you
> > > shouldn't
> > > have to care about that in basic_string. Just use it!
> >
> > This is something interesting (i.e., I'm not sure what the standard says
> ;)
> >
> > As far as the instantiations for char and wchar_t are concerned, as an
> > implementor I'm allowed to peek, right?
>
> Maybe. :-)
>
> If it really matters, and you know the implementors of allocator and
> char_traits well enough, you might use some inside info. The risk, of
> course, is that your code might break if their implementation changes. Is it
> worth the risk?
Given the performance implications of not peeking, I'd say yes.
That's what a testsuite is for. Besides, we're all one happy library, no?
Jerry Quinn