Re: Review Request 49352: Added a flag parser for hashset.

2016-06-29 Thread Klaus Ma


> On June 30, 2016, 12:59 a.m., Klaus Ma wrote:
> > src/common/parse.hpp, lines 150-152
> > 
> >
> > Call `insert` directly should be fine. `set` will help to avoid 
> > duplicated item.
> 
> Guangya Liu wrote:
> Here I need to return error if there are diplicate items, seems I cannot 
> use `set` for this as `set` do not have a method like `contain` which can 
> enable me to check the duplicate items, comments?

Return value of set: The single element versions (1) return a pair, with its 
member pair::first set to an iterator pointing to either the newly inserted 
element or to the equivalent element already in the set. **The pair::second 
element in the pair is set to true if a new element was inserted or false if an 
equivalent element already existed.**

http://www.cplusplus.com/reference/set/set/insert/


- Klaus


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


On June 29, 2016, 8:12 p.m., Guangya Liu wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/49352/
> ---
> 
> (Updated June 29, 2016, 8:12 p.m.)
> 
> 
> Review request for mesos and Benjamin Mahler.
> 
> 
> Bugs: MESOS-5743
> https://issues.apache.org/jira/browse/MESOS-5743
> 
> 
> Repository: mesos
> 
> 
> Description
> ---
> 
> Added a flag parser for hashset.
> 
> 
> Diffs
> -
> 
>   src/common/parse.hpp 19e56dbeb765f8bec92e0a3615f6f7c12466fa9e 
> 
> Diff: https://reviews.apache.org/r/49352/diff/
> 
> 
> Testing
> ---
> 
> make
> make check
> 
> 
> Thanks,
> 
> Guangya Liu
> 
>



Re: Review Request 49352: Added a flag parser for hashset.

2016-06-29 Thread Guangya Liu


> On 六月 29, 2016, 4:59 p.m., Klaus Ma wrote:
> > src/common/parse.hpp, lines 150-152
> > 
> >
> > Call `insert` directly should be fine. `set` will help to avoid 
> > duplicated item.

Here I need to return error if there are diplicate items, seems I cannot use 
`set` for this as `set` do not have a method like `contain` which can enable me 
to check the duplicate items, comments?


- Guangya


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


On 六月 29, 2016, 12:12 p.m., Guangya Liu wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/49352/
> ---
> 
> (Updated 六月 29, 2016, 12:12 p.m.)
> 
> 
> Review request for mesos and Benjamin Mahler.
> 
> 
> Bugs: MESOS-5743
> https://issues.apache.org/jira/browse/MESOS-5743
> 
> 
> Repository: mesos
> 
> 
> Description
> ---
> 
> Added a flag parser for hashset.
> 
> 
> Diffs
> -
> 
>   src/common/parse.hpp 19e56dbeb765f8bec92e0a3615f6f7c12466fa9e 
> 
> Diff: https://reviews.apache.org/r/49352/diff/
> 
> 
> Testing
> ---
> 
> make
> make check
> 
> 
> Thanks,
> 
> Guangya Liu
> 
>



Re: Review Request 49352: Added a flag parser for hashset.

2016-06-29 Thread Guangya Liu


> On 六月 29, 2016, 11:07 p.m., Benjamin Mahler wrote:
> > src/common/parse.hpp, line 144
> > 
> >
> > Can we use std::set for now?

As I want to check if there are duplicate items in the flag of 
`allocator_fairness_excluded_resource_names`, so here seems `hashset` is a good 
option as I can check if there are duplicate items via `contains` method. So 
here I would prefer to use `hashset` but return some error if there are some 
duplicate items, comments?


- Guangya


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


On 六月 29, 2016, 12:12 p.m., Guangya Liu wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/49352/
> ---
> 
> (Updated 六月 29, 2016, 12:12 p.m.)
> 
> 
> Review request for mesos and Benjamin Mahler.
> 
> 
> Bugs: MESOS-5743
> https://issues.apache.org/jira/browse/MESOS-5743
> 
> 
> Repository: mesos
> 
> 
> Description
> ---
> 
> Added a flag parser for hashset.
> 
> 
> Diffs
> -
> 
>   src/common/parse.hpp 19e56dbeb765f8bec92e0a3615f6f7c12466fa9e 
> 
> Diff: https://reviews.apache.org/r/49352/diff/
> 
> 
> Testing
> ---
> 
> make
> make check
> 
> 
> Thanks,
> 
> Guangya Liu
> 
>



Re: Review Request 49352: Added a flag parser for hashset.

2016-06-29 Thread Benjamin Mahler

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




src/common/parse.hpp (line 144)


Can we use std::set for now?



src/common/parse.hpp (lines 148 - 155)


We should let the user know that duplicate entries are an error. Otherwise, 
if intending to accomplish something via the duplicates and we silently accept 
them, they are unaware that the duplicates have no effect.


- Benjamin Mahler


On June 29, 2016, 12:12 p.m., Guangya Liu wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/49352/
> ---
> 
> (Updated June 29, 2016, 12:12 p.m.)
> 
> 
> Review request for mesos and Benjamin Mahler.
> 
> 
> Bugs: MESOS-5743
> https://issues.apache.org/jira/browse/MESOS-5743
> 
> 
> Repository: mesos
> 
> 
> Description
> ---
> 
> Added a flag parser for hashset.
> 
> 
> Diffs
> -
> 
>   src/common/parse.hpp 19e56dbeb765f8bec92e0a3615f6f7c12466fa9e 
> 
> Diff: https://reviews.apache.org/r/49352/diff/
> 
> 
> Testing
> ---
> 
> make
> make check
> 
> 
> Thanks,
> 
> Guangya Liu
> 
>