foreach vs. iterators

Oskar Linde olREM at OVEnada.kth.se
Sat Nov 4 01:51:03 PST 2006


Walter Bright wrote:

> You're right about that being a problem with opApply.

Does it have to be?

If the body of the opApply is available to the compiler and the delegate
parameter is a compile time constant (as it is in the normal foreach case),
does anything prevent the compiler from inlining the opApply together with
the delegate body?

Would there still be a speed hit if this was done?

I have many cases that would gain a lot if the compiler inlined functions
taking compile time known delegates together with the delegate call. I hope
there is nothing fundamental preventing this from happening.

/Oskar




More information about the Digitalmars-d-announce mailing list