|
Boost : |
From: Pavol Droba (droba_at_[hidden])
Date: 2003-11-07 02:05:55
On Fri, Nov 07, 2003 at 02:03:15PM -0800, John Torjo wrote:
>
> Matthew Hurd wrote:
>
> >Any lib related to Boost that uses expression templates for string or
> >buffer
> >operations to minimize the temporary objects? Only thinking of
> >concatenation but I guess it might apply elsewhere.
> >
> >Might be a neat addition to the string algorithm library.
>
> I would think so ;)
> However, I'm not sure how realistic this could be.
> Just consider this:
>
> for ( int i = 0; i < 10000; ++i)
> s += "s";
>
> In cases like this, expression templates would be useless, IMO.
>
> Anyway, Pavol, any thoughts?
>
Expression templates might be an interesting idea, but I don't think that it
fits into the scope of the string_algo library.
This is more related as an extension to std::string. string_algo library
does not work with str::string only and it is oriented towards algorithms.
Besides that, it could be hard to estimate the benefits, that such a framework
could bring.
There isn't realy much to optimize except to removing temporary objects.
Given that fact, that string expression are usualy not very complicated and
usualy contains only a small number of operations, it is easy to rewrite such
an expression to use in-place variants if an optimalization is required.
Anyway, if somebody could come with such a framework, I'll be interested to see it.
Regards,
Pavol
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk