[PATCH] llvm::all_of

Pete Cooper peter_cooper at apple.com
Wed May 13 15:07:43 PDT 2015


It compiled fine.  Running ‘make check-all’ now.  If it passes with this single version then are you ok with me committing?

template<typename R, class UnaryPredicate>
bool all_of(R &&Range, UnaryPredicate &&P) {
  return std::all_of(Range.begin(), Range.end(),
                     std::forward<UnaryPredicate>(P));
}

Cheers,
Pete
> On May 13, 2015, at 2:54 PM, David Blaikie <dblaikie at gmail.com> wrote:
> 
> Drop the static inline (the static part would cause ODR violations in other inline functions in headers that call this function, the inline part is mostly redundant because it just changes the linkage which implicit template specializations already have anyway)
> 
> Wonder if there's a way to get these down to one implementation...
> 
> template<typename Range, class UnaryPredicate>
> bool all_of(Range &&R, UnaryPredicate &&P) {
>   return std::all_of(R.begin(), R.end(), std::forward<UnaryPredicate>(P));
> }
> 
> Maybe?
> 
> On Wed, May 13, 2015 at 2:41 PM, Pete Cooper <peter_cooper at apple.com <mailto:peter_cooper at apple.com>> wrote:
> Hey David
> 
> (For the benefit of mailing archives, this is a spin-off from a discussion on http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20150511/276283.html <http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20150511/276283.html>)
> 
> This is the patch we discussed to add an llvm version of std::all_of which doesn’t need begin/end.  Also added a user of it to LoopInfo which was the motivating example you pointed out.
> 
> Comments welcome.
> 
> Cheers,
> Pete
> 
> 
> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150513/947f288b/attachment.html>


More information about the llvm-commits mailing list