Ian, in fact, in my case, only one Option is available at a time. For
example:

class Process {
  void callback(const Option<T>& option)
  {
    // Update the minimal.
    minimal = min(minimal, option);
  }
  Option<T> minimal;
}


On Tue, Dec 10, 2013 at 11:17 AM, Ian Downes <[email protected]> wrote:

> What about just supporting min of an iterable of Option<>s?
>
> On Dec 10, 2013, at 10:49 AM, "Ben Mahler" <[email protected]>
> wrote:
>
> >
> > -----------------------------------------------------------
> > This is an automatically generated e-mail. To reply, visit:
> > https://reviews.apache.org/r/16158/#review30109
> > -----------------------------------------------------------
> >
> >
> > Is the alternative just one additional line of code?
> >
> > Option<int> lowest;
> >
> > foreach (int value, values) {
> >  if (lowest.isNone() || value < lowest.get()) {
> >    lowest = value;
> >  }
> > }
> >
> > - Ben Mahler
> >
> >
> > On Dec. 10, 2013, 6:44 p.m., Jie Yu wrote:
> >>
> >> -----------------------------------------------------------
> >> This is an automatically generated e-mail. To reply, visit:
> >> https://reviews.apache.org/r/16158/
> >> -----------------------------------------------------------
> >>
> >> (Updated Dec. 10, 2013, 6:44 p.m.)
> >>
> >>
> >> Review request for mesos, Benjamin Hindman, Ben Mahler, and Jiang Yan
> Xu.
> >>
> >>
> >> Repository: mesos-git
> >>
> >>
> >> Description
> >> -------
> >>
> >> See summary. It will be useful when you wanna keep track of the global
> minimal. For example:
> >>
> >> Option<int> lowest;
> >>
> >> foreach (int value, values) {
> >>  lowest = min(lowest, value);
> >> }
> >>
> >>
> >> Diffs
> >> -----
> >>
> >>  3rdparty/libprocess/3rdparty/Makefile.am f9d1aed
> >>  3rdparty/libprocess/3rdparty/stout/Makefile.am e46e763
> >>  3rdparty/libprocess/3rdparty/stout/include/stout/min.hpp PRE-CREATION
> >>  3rdparty/libprocess/3rdparty/stout/tests/min_tests.cpp PRE-CREATION
> >>
> >> Diff: https://reviews.apache.org/r/16158/diff/
> >>
> >>
> >> Testing
> >> -------
> >>
> >> make check
> >>
> >>
> >> Thanks,
> >>
> >> Jie Yu
> >>
> >>
> >
>
>

Reply via email to