From: Jonathan Turkanis (technews_at_[hidden])
Date: 2005-01-06 22:45:11


Jonathan Turkanis wrote:

> 4. Thorsten asks why the widening and narrowing functions shouldn't be
> non-member functions. One answer is that code conversion can be
> (slightly) more efficient if a large buffer is used. Making the core
> conversion functions member functions allows buffers to be used for
> several string conversions.

Hmmm ... This is true, but unfortunately doesn't apply to the version I posted.

To take advantage of a large buffer, the input would have to be presented in a
manner that gives the implementaion access to underlying characters arrays.
(This would be the case if, e.g., the input were basic_strings, so that data()
could be used, or if there were a standard iterator category 'Contiguous
Traversal': http://tinyurl.com/4wynl.)

I think the added flexibility of the overloads taking iterators is more
significant than the ability to buffer.

Jonathan