Boost logo

Boost :

Subject: Re: [boost] [rfc] loop utility
From: Tim Blechmann (tim_at_[hidden])
Date: 2013-01-31 07:28:26


hi thomas,

>> > iac, if we want to do something N times, we just want to loop without
>> > thinking about integer ranges or incrementing integers ;)
> And this is exactly what Boost.Range does ;)
> Honestly, I don't see the added advantage the proposed boost::loop gives
> since for_each is a more or less standardized name for a function
> iterating over some range, where boost.range gives you the facilities to
> loop over a range of integers. Also my visual preferences don't see the
> extra few characters you need to type as visual noise. True it adds
> verbosity, however, the added verbosity highlights the intend (this is
> also true for the range based for loops in C++11 as Andrey proposed).
> Additionally, the boost range solution gives you the flexibility to use
> any range (from adapting the start of the range to specifying the step).

i think there are different intentions. the question is: what do you
want to express?

* iterate over a range of integers
* do something N times

boost.range is wonderful to express the first case! my proposal tries to
add expressive power for the second ...

again comparing this to ruby:
(0..9).each {|i| print i, "\n"}
10.times {|i| print i, "\n"}

or supercollider:
(0..9).do (_.postln)
10.do (_.postln)

one does not need to know these languages to see that the developer
wants to express different things ;)

cheers,
tim


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