Boost logo

Boost :

From: Ross MacGregor (ross__macgregor_at_[hidden])
Date: 2003-10-23 03:51:32


Thorsten Ottosen wrote:
> we're trying to guard our selves from a algorithm explosion problem.

I see your point. Now that I look at the chaining aspect, I don't see a
great need for it anyway.

What I understand is that the original inplace algorithms returned a
reference so that something like this would be possible:

A) func( trim(to_upper(s)) );

This saves space and is elegant but it is also a little ambiguous too
(is s modified?). This can lead to unpleasant side effects, so an
explicit variant is being considered:

B) func( trim_inplace(to_upper_inplace(s)) );

This is a much less ambiguous operation, but I think I would be just as
happy learning the single inplace set and writing the operation as:

to_upper(s);
trim(s);
func(s);

Did I miss a more important aspect of chaining?

> As for the chaining, then maybe we need some device that allows of to
call n
> function operation on eachother's result:
>
> string s:
> chain( &trim, &to_upper, s );
>
> ?
>
> Thorsten

Then I could write my little code snippit as:

chain( &trim, &to_upper, s );
func(s);

Correct? This would perhaps be less error prone without the duplicate
prameters, but I don't find it easier to read.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk