This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [RFC] Money_get::do_get appends?!?
On Mon, Feb 04, 2002 at 12:57:20AM +0100, Paolo Carlini wrote:
> Nathan Myers wrote:
> >If the user passes in "Golgafrincham" the user
> >has to get back either "123" or "Golgafrincham". You can avoid an
> >allocation by parsing characters into an array on the stack and
> >expanding to secondary storage only if it's exceeded, and then copying
> >into the string storage. If it helps any you can make it (or a separate
> >function, for the purpose) a friend of basic_string<>::_Rep. Or you
> >can use basic_string<>::swap.
> >
>
> I see. In fact I suspected that something like this was needed in such
> cases.
Yes, it is supposed to be this way for all istream extractions.
Any cases where it doesn't say so are defects the committee needs
to know about.
> Tomorrow, if Benjamin does not beat me, I will check the current
> implementation wrt what you indicated. Definitely, we must fix it
> not to always append chars on the string passed by reference.
Benjamin, please stop beating Paolo. He works hard enough, without.
If you get him used to beatings, he'll just move to another project
where they beat him harder.
Nathan Myers
ncm at cantrip dot org