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


Ship it!




Ship It!

- Jie Yu


On Sept. 13, 2017, 3:23 p.m., Benjamin Bannier wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/62282/
> -----------------------------------------------------------
> 
> (Updated Sept. 13, 2017, 3:23 p.m.)
> 
> 
> Review request for mesos, Jie Yu and Jan Schlicht.
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> When implementing 'operator==' for protobufs as a patter we typically
> first check that two 'optional' fields are set for both the left- and
> righthand side, and only then compare their values, e.g., given a
> definition
> 
>     message Foo {
>       optional string bar = 1;
>     }
> 
> we would implement 'operator==' similar to the following,
> 
>    bool operator==(const Foo& lhs, const Foo& rhs)
>    {
>        if (lhs.has_bar() != rhs.has_bar()) {
>          return false;
>        }
> 
>        if (lhs.bar() != rhs.bar()) {
>          return false;
>        }
> 
>        return true;
>    }
> 
> One reason for this is that it allows us to distinguish an unset field
> from a set field containing a default constructed value (if e.g.,
> above 'lhs.has_bar()' was 'false', 'lhs.bar()' would return an empty
> string).
> 
> This patch makes sure we use the same pattern when checking
> 'Resource::DiskInfo::Source' for equality.
> 
> 
> Diffs
> -----
> 
>   src/common/resources.cpp 14b600ca1577be4910164396c75b866b53439ade 
> 
> 
> Diff: https://reviews.apache.org/r/62282/diff/1/
> 
> 
> Testing
> -------
> 
> `make check`
> 
> 
> Thanks,
> 
> Benjamin Bannier
> 
>

Reply via email to