[Numpy-discussion] Proposed Roadmap Overview

Matthieu Brucher matthieu.brucher@gmail....
Mon Feb 20 11:19:52 CST 2012

> C++11 has this option:
> for (auto& item : container) {
>     // iterate over the container object,
>     // get a reference to each item
>     //
>     // "container" can be an STL class or
>     // A C-style array with known size.
> }
> Which does this:
> for item in container:
>     pass

It is even better than using the macro way because the compiler knows
everything is constant (start and end), so it can do better things.

> > Using C++ templates to generate ufunc loops is an obvious application,
> > but again, in the simple examples
> Template metaprogramming?
> Don't even think about it. It is brain dead to try to outsmart the
> compiler.

It is really easy to outsmart the compiler. Really. I use metaprogramming
for loop creation to optimize cache behavior, communication in parallel
environments, and there is no way the compiler would have done things as
efficiently (and there is a lot of leeway to enhance my code).

Information System Engineer, Ph.D.
Blog: http://matt.eifelle.com
LinkedIn: http://www.linkedin.com/in/matthieubrucher
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20120220/421bedd9/attachment.html 

More information about the NumPy-Discussion mailing list