[llvm-commits] [llvm] r165073 - in /llvm/trunk: include/llvm/ADT/SetVector.h lib/Transforms/Scalar/SROA.cpp

Sean Silva silvas at purdue.edu
Tue Oct 2 20:38:28 PDT 2012


> I find an explicit loop orders of magnitude easier to read than template hacks, but that's just me.

Sadly, I find that this is usually the case with most of the more
basic STL algorithms (even with lambdas).

<monologue>
In a sense, when I deep-dive'd into the STL and learned all about it,
I think that one of the most important things I learned was how to
confidently open-code all of the (basic) algorithms, since in a lot of
cases (most?) you end up needing a tweak like this, or need to
multiplex several algorithms simultaneously so that you only make one
pass over the data.

Nonetheless, being able to model the operation conceptually with the
STL algorithms is invaluable, even if you end up open-coding the end
result. Also, recognizing when the algorithms appear in code and
thinking about the operation at the STL algorithm level is invaluable
too. Almost all of this carries over directly to C as well (where you
have no choice but to open-code the algorithms).
</monologue>

-- Sean Silva

On Tue, Oct 2, 2012 at 8:48 PM, Jakob Stoklund Olesen <stoklund at 2pi.dk> wrote:
>
> On Oct 2, 2012, at 5:43 PM, Chandler Carruth <chandlerc at gmail.com> wrote:
>
>> I can go back to my original idea for solving this: make a predicate that calls the set_.erase(). I think that's slightly better than open coding any of these loops.... It's just a wrapper predicate.
>
> I find an explicit loop orders of magnitude easier to read than template hacks, but that's just me.
>
> /jakob
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits



More information about the llvm-commits mailing list