> On Nov. 15, 2014, 11 p.m., Michael Park wrote:
> > include/mesos/resources.hpp, lines 102-106
> > <https://reviews.apache.org/r/28089/diff/1/?file=764758#file764758line102>
> >
> >     I would suggest keeping the behavior symmetric to `std::vector` here. 
> > I'm guessing this was added due to the annoyance around initialization. The 
> > same issue existed for `std::vector` in `C++98` but it's been fixed with 
> > `std::initializer_list` constructors in `C++11`. We can implement one for 
> > `Resources` as well.
> >     
> >     ```cpp
> >     // C++98
> >     std::vector<int> v;
> >     v.push_back(1);
> >     v.push_back(2);
> >     
> >     // C++11
> >     std::vector<int> v = {1, 2};
> >     ```
> >     
> >     For `Resources`, it would look like:
> >     
> >     ```cpp
> >     Resources(std::initializer_list<Resource> resources) {
> >       foreach (const Resource& resource, resources) {
> >         *this += resource;
> >       }
> >     }
> >     ```
> >     
> >     Then we can do the following transformation:
> >     
> >     ```cpp
> >     // Before
> >     Resource cpus1 = Resources::parse("cpus", "1", "role1").get();
> >     Resources r1;
> >     r1 += cpus1;
> >     
> >     // After
> >     Resources r1 = { Resources::parse("cpus", "1", "role1").get() };
> >     ```
> 
> Jie Yu wrote:
>     I'll add a TODO. Let's clean it up once we allow initialization list.

Ok. Just a note, `initialization_list`s are enforced as of 
https://reviews.apache.org/r/27945/ :)


> On Nov. 15, 2014, 11 p.m., Michael Park wrote:
> > src/common/resources.cpp, lines 69-71
> > <https://reviews.apache.org/r/28089/diff/1/?file=764759#file764759line69>
> >
> >     How about using `combinable` here?
> >     `if (!combinable(left, right)) { return false; }`
> 
> Jie Yu wrote:
>     With DiskInfo that will be added in the near future, this function will 
> be changed so that it's not quite easy to re-use combinable here. So I would 
> rather not to change it here.

Agreed, I later noticed that `combinable` and `removable` is actually 
equivalent at this point but will probably differ with the `Resource` changes 
that are coming.


- Michael


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


On Nov. 17, 2014, 8:34 p.m., Jie Yu wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/28089/
> -----------------------------------------------------------
> 
> (Updated Nov. 17, 2014, 8:34 p.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
> -------
> 
> Hide operators for Resource object. Split "matches" to handle future first 
> class infos.
> 
> 
> Diffs
> -----
> 
>   include/mesos/resources.hpp 0e37170262d3470570a3436b7835bb1d4a121056 
>   src/common/resources.cpp e9a0c85dc3748aa635843d98cd5993d5648ec5c2 
>   src/tests/resources_tests.cpp 3e50889ff2433930bd137a9d836d0a8bfc2d0388 
> 
> Diff: https://reviews.apache.org/r/28089/diff/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> Jie Yu
> 
>

Reply via email to