> On Sept. 23, 2015, 12:58 a.m., Michael Park wrote: > > src/common/values.cpp, line 204 > > <https://reviews.apache.org/r/38158/diff/13/?file=1081516#file1081516line204> > > > > Why not pass by value? > > Joerg Schad wrote: > Not sure why you would want to pass either by value. Result we want to > use for the output and the ranges vector I also wouldn't copy.
Sorry, I was referring to the `ranges` vector here. I'm asking why not pass by value for the ranges vector because it's a stricter requirement than necessary for the input to be an rvalue. In terms of the API of this function, what we care about is whether we have our own `ranges` that we can modify and such. Binding with rvalue-ref is one way to do it, but as I mentioned, a stricter requirement than necessary. By taking it by value, if an actual temporary is passed the entire thing is optimized out, if a `std::move`d variable is passed it's moved, and if an lvalue is passed it gets copied. I think these are the exact semantics we want within the scope of this function, and it's upto the caller to decide what to pass. - Michael ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/38158/#review100091 ----------------------------------------------------------- On Sept. 22, 2015, 8:55 p.m., Joerg Schad wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/38158/ > ----------------------------------------------------------- > > (Updated Sept. 22, 2015, 8:55 p.m.) > > > Review request for mesos, Bernd Mathiske, Joris Van Remoortere, and Till > Toenshoff. > > > Bugs: MESOS-3051 > https://issues.apache.org/jira/browse/MESOS-3051 > > > Repository: mesos > > > Description > ------- > > The goal of this refactoring was to reuse the Ranges objects as much as > possible, as prior there was substantial time spend in allocation/destruction > (MESOS-3051). > > > Diffs > ----- > > src/common/values.cpp 750264e603b4cde2011f07f4434a4b34fe3e512f > src/tests/resources_tests.cpp 0318885336409f7cc9dbd4a3daa9b52db197bbd1 > src/tests/values_tests.cpp fc35d97894a2de6207b9337180e2160e6f2cb1f5 > > Diff: https://reviews.apache.org/r/38158/diff/ > > > Testing > ------- > > make check > > > Thanks, > > Joerg Schad > >
