-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/26273/#review55250
-----------------------------------------------------------


Can you link in the motivating patch?

It seems nice to keep a single foreach looping construct, and instead transform 
what we're looping over. In this case, I believe you wanted to reverse a vector?

```
vector<Isolator*> isolators);

foreach (Isolator* isolator, reversed(isolators)) {
  // reversed() is same as python built-in: 
https://docs.python.org/2/library/functions.html#reversed
}

foreach (Isolator* isolator, boost::adaptors::reverse(isolators) {
  ...
}
```

Because what happens when we want to additional iteration constraints?

```
foreach (string word, reversed(sorted(words))) {
  // ...
}

```

This approach is composable, as opposed to new looping constructs:

```
unique_reversed_foreach (string word, words) {
  // ...
}

```

- Ben Mahler


On Oct. 2, 2014, 6:15 p.m., Ian Downes wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/26273/
> -----------------------------------------------------------
> 
> (Updated Oct. 2, 2014, 6:15 p.m.)
> 
> 
> Review request for mesos, Jie Yu and Vinod Kone.
> 
> 
> Repository: mesos-git
> 
> 
> Description
> -------
> 
> Define reverseforeach from Boost.
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/3rdparty/stout/include/stout/foreach.hpp 
> 0739d6360464873533af07e67f6beb7804af43aa 
> 
> Diff: https://reviews.apache.org/r/26273/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Ian Downes
> 
>

Reply via email to