[llvm-dev] When to use auto instead of iterator/const_iterator?

Zachary Turner via llvm-dev
2017-05-02T21:52:19Z

On Tue, May 2, 2017 at 9:24 AM Matthias Braun via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

>
> This should be written as:
>
> for (const SDep &Succ : SU->Succs) {
>   if (Succ.isCtrl())
>     ++NUmberDeps;
> }
>

You may even wish to write this as:

NumberDeps = llvm::count_if(SU->Succs, [](const SDep &S) { return
S.isCtrl(); });
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20170502/2e344b08/attachment.html>