Boost logo

Boost :

Subject: Re: [boost] Assign V2 - first impression
From: Christopher Jefferson (chris_at_[hidden])
Date: 2011-06-24 12:06:59


On 24 Jun 2011, at 10:24, er wrote:

>
>> I am sure that it is a powerful library, but I really have no idea at all what is going on. I can't even parse the first line as valid C++ in any way. You need better examples, and also is that really the best way you could find to express repeating?
>
> If I try to imagine what the interface would look like after taking into account some of the suggestions that were made, this sentence:
>
> "Create data elements by mapping 1, 10, 100, 1000 by function f, and insert each result in cont by invoking modifier push_front."
>
> translates to
>
> (
> push_front<1>( cont ) % ( _data = f ) % ( _repeat = n )
> )( 1, 10, 100, 1000 );
>
>
> Questions :
> - is it more readable, now?

That is more readable.
> - What if each example was preceded by its English equivalent. Is this a bit of stretch or a reasonable approach?
I think this is a good idea. In general I think you can't over-explain basic examples.

The style the library is using is still.. interesting. I'm still not sure why the '_repeat = n' comes in, and things seem attached strangely. I might perfer something that looked more like boost range's

make_range(1,10,100,1000) | f | push_front(cont)

But, that might well not design as well as I think it would, or not do what you are suggesting.

Chris


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