[RFC] Strive to prefer sbumpc() to snextc()?!?
Paolo Carlini
pcarlini@suse.de
Thu Apr 22 19:42:00 GMT 2004
Pétur Runólfsson wrote:
>The best solution may be to use neither sbumpc() nor snextc(), but
>instead access the buffer directly, similar to what is already done
>in __copy_streambufs:
>
> while (!_Traits::eq_int_type(__c, _Traits::eof()))
> {
> const size_t __n = __sbin->egptr() - __sbin->gptr();
> if (__n > 1)
> {
> const char_type* p = traits_type::find(__sbin->gptr(),
> __n, __delim);
> if (p)
> __n = p - __sbin->gptr();
> __str.append(__sbin->gptr(), __n);
> __sbin->gbump(__n);
>
>In most cases, this should cause only a single call to append.
>
>
However, I agree that this cute solution has the potential to be the
fastest one
by far ;) ... Perhaps I can implement it in a reasonable amount of time...
Thanks,
Paolo.
More information about the Libstdc++
mailing list