> On April 28, 2015, 2:08 a.m., Ben Mahler wrote: > > docs/mesos-c++-style-guide.md, line 162 > > <https://reviews.apache.org/r/33558/diff/3/?file=942044#file942044line162> > > > > When would we use capture by reference? Seems prone to mistakes? > > Michael Park wrote: > > When would we use capture by reference? > > We would use it when we know the lambda will be invoked within the scope. > For example, if we're calling an algorithm (e.g. `std::sort`) that takes a > lambda, we know that it'll be invoked within the scope. > > > Seems prone to mistakes? > > It is indeed prone to mistakes which is the motivation behind `*never* > use default capture by reference`.
Ah, right, synchronous code. :) - Ben ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/33558/#review81769 ----------------------------------------------------------- On April 26, 2015, 8:26 p.m., Benjamin Hindman wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/33558/ > ----------------------------------------------------------- > > (Updated April 26, 2015, 8:26 p.m.) > > > Review request for mesos, Ben Mahler, Joris Van Remoortere, Michael Park, and > Vinod Kone. > > > Repository: mesos > > > Description > ------- > > See summary. Note that there will be a follow up review which enacts this > style in the code base. > > > Diffs > ----- > > docs/mesos-c++-style-guide.md fe98f90ad0b0f5dd38af97e85062e90cee8de99e > > Diff: https://reviews.apache.org/r/33558/diff/ > > > Testing > ------- > > N/A > > > Thanks, > > Benjamin Hindman > >
