Boost logo

Boost :

Subject: Re: [boost] simple range adapter
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2009-10-06 07:07:22

Neal Becker wrote:

> OK, how about the attached?

In your attached example,

int main () {
   double x[10];
   for (int i = 0; i < 10; ++i)
     x[i] = i;

   double y = sum (make_array_range (x, 10));
   std::cout << y << '\n';

You could write instead of writing make_array_range(x, 10):
- x (arrays are ranges)
- as_array(x) (as_array is a no-op here, this function is only useful
for arrays of chars which are a special case)
- make_iterator_range(x, x+10) (the general-purpose mechanism to define
ranges from iterators)

Boost list run by bdawes at, gregod at, cpdaniel at, john at