On Wed, May 14, 2014 at 11:45 AM, David Blaikie <[email protected]> wrote: > On Wed, May 14, 2014 at 8:01 AM, Aaron Ballman <[email protected]> wrote: >> Author: aaronballman >> Date: Wed May 14 10:01:43 2014 >> New Revision: 208783 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=208783&view=rev >> Log: >> Replacing some manual iterations with standard algorithms. No functional >> changes intended. >> >> Modified: >> cfe/trunk/lib/Analysis/ThreadSafety.cpp >> >> Modified: cfe/trunk/lib/Analysis/ThreadSafety.cpp >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/ThreadSafety.cpp?rev=208783&r1=208782&r2=208783&view=diff >> ============================================================================== >> --- cfe/trunk/lib/Analysis/ThreadSafety.cpp (original) >> +++ cfe/trunk/lib/Analysis/ThreadSafety.cpp Wed May 14 10:01:43 2014 >> @@ -849,44 +849,37 @@ public: >> return false; >> } >> >> - // Returns an iterator >> iterator findLockIter(FactManager &FM, const SExpr &M) { >> - for (iterator I = begin(), E = end(); I != E; ++I) { >> - const SExpr &Exp = FM[*I].MutID; >> - if (Exp.matches(M)) >> - return I; >> - } >> - return end(); >> + return std::find_if(begin(), end(), [&FM, &M](FactID ID) { > > Opinions differ, but for my money just default capturing by reference > with "[&]" is fine especially for these sort of lambda uses. For > lambdas being squirreled away to live longer than their full > expression, that's different (& then you might want to capture by > value, etc)
I have no strong opinion one way or the other. The style guideline is silent on the topic though -- should that be updated? ~Aaron _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
