[Numpy-discussion] Proposed Roadmap Overview

Sturla Molden sturla@molden...
Sat Feb 18 18:35:37 CST 2012

Den 19.02.2012 01:12, skrev Nathaniel Smith:
> I don't oppose it, but I admit I'm not really clear on what the
> supposed advantages would be. Everyone seems to agree that
>    -- Only a carefully-chosen subset of C++ features should be used
>    -- But this subset would be pretty useful
> I wonder if anyone is actually thinking of the same subset :-).

Probably not, everybody have their own favourite subset.

> Chuck mentioned iterators as one advantage. I don't understand, since
> iterators aren't even a C++ feature, they're just objects with "next"
> and "dereference" operators. The only difference between these is
> spelling:
>    for (my_iter i = foo.begin(); i != foo.end(); ++i) { ... }
>    for (my_iter i = my_iter_begin(foo); !my_iter_ended(&i);
> my_iter_next(&i)) { ... }
> So I assume he's thinking about something more, but the discussion has
> been too high-level for me to figure out what.

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:

> 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.


More information about the NumPy-Discussion mailing list