> On Nov. 15, 2014, 7:22 p.m., Ben Mahler wrote: > > include/mesos/resources.hpp, lines 192-213 > > <https://reviews.apache.org/r/28092/diff/1/?file=765009#file765009line192> > > > > So implicit conversion is not enough for the tests to remain unchanged? > > Seems a bit too clunky without these operators IMO. > > Michael Park wrote: > For these ones, there's no implicit conversion to `Resources` for the lhs > since the `operator`s are member functions (e.g. `Resources > Resources::operator + (const Resources& right)`) > It would be nice to implement these as single non-member functions (e.g. > `Resources operator + (const Resources& lhs, const Resources& rhs)`), > but that doesn't quite work due to the implicit conversion from > `Resources` to `const google::protobuf::RepeatedPtrField<Resource>&` (i.e. > `Resources::operator const google::protobuf::RepeatedPtrField<Resource>& ()`).
We only use those operators in tests (not many places). I still think those interfaces are not necessary and introducing an explicit step (from protobuf to Resources) forces the writer to think about validation, which is a good thing. - Jie ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/28092/#review61654 ----------------------------------------------------------- On Nov. 15, 2014, 7:11 a.m., Jie Yu wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/28092/ > ----------------------------------------------------------- > > (Updated Nov. 15, 2014, 7:11 a.m.) > > > Review request for mesos, Ben Mahler and Vinod Kone. > > > Bugs: MESOS-1974 > https://issues.apache.org/jira/browse/MESOS-1974 > > > Repository: mesos-git > > > Description > ------- > > Those interfaces are not good because repeated Resource ptr is not validated > (and flattened). > > > Diffs > ----- > > include/mesos/resources.hpp 0e37170 > src/tests/master_tests.cpp 66423a9 > > Diff: https://reviews.apache.org/r/28092/diff/ > > > Testing > ------- > > make check > > > Thanks, > > Jie Yu > >
