> On Dec. 15, 2014, 6:08 p.m., Dominic Hamon wrote:
> > include/mesos/resources.hpp, line 213
> > <https://reviews.apache.org/r/29018/diff/1/?file=791218#file791218line213>
> >
> >     transformations.emplace_back (if we have it in 4.4) might save you the 
> > explicit move call, and will certainly save you the extra construction.

Given `std::vector<T>`, `emplace_back` and `push_back` are equivalent when 
called with a single argument of type `T`, whether rvalue or lvalue.

The times `emplace_back` wins the race is when we save a move construction.
For example, given `vector<std::string> v;` `v.emplace_back("foo")` is 
preferred over `v.push_back("foo")` since `emplace_back` saves a move 
construction.

In this case however, you don't save anything by using `emplace_back`.

(Of course, unless I'm missing something)


- Michael


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


On Dec. 13, 2014, 5:57 a.m., Jie Yu wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/29018/
> -----------------------------------------------------------
> 
> (Updated Dec. 13, 2014, 5:57 a.m.)
> 
> 
> Review request for mesos and Ben Mahler.
> 
> 
> Bugs: MESOS-2030
>     https://issues.apache.org/jira/browse/MESOS-2030
> 
> 
> Repository: mesos-git
> 
> 
> Description
> -------
> 
> Added abstraction for resources transformation. Split from 
> https://reviews.apache.org/r/28720/.
> 
> 
> Diffs
> -----
> 
>   include/mesos/resources.hpp 296553af93ec8457dad04ac018f03f36df654fdc 
>   src/common/resources.cpp 9bf7ae9148d6db2829cc2866ac048fe018ae2c92 
> 
> Diff: https://reviews.apache.org/r/29018/diff/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> Jie Yu
> 
>

Reply via email to