> On Dec. 10, 2013, 6:49 p.m., Ben Mahler wrote:
> > Is the alternative just one additional line of code?
> >
> > Option<int> lowest;
> >
> > foreach (int value, values) {
> > if (lowest.isNone() || value < lowest.get()) {
> > lowest = value;
> > }
> > }
>
> Jie Yu wrote:
> Yeah, but I think "lowest = min(lowest, value);" is more obvious (w.r.t.
> expressing my intention) and easier to read. What do you think?
>
> Ben Mahler wrote:
> I agree it is more clear, but my concern here is mostly around
> overloading <algorithm> functions for our datatypes. If we wrap std::min, why
> not wrap std::max, std::sort, and many other things from <algorithm>? Is
> there a large benefit?
>
> Jie Yu wrote:
> std::max will be in a separate review.
Ok, perhaps this should live in stout/algorithm.hpp? Or, it seems better to
place it in option.hpp and move it out if we find that we're wrapping
<algorithm> functions for things other than Options..
- Ben
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/16158/#review30109
-----------------------------------------------------------
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
>
>