
12 Oct
2007
12 Oct
'07
6:40 p.m.
on Thu Oct 11 2007, "Mike Marchywka"
No we do not. The compiler does not need to know the contents of f to generate that code. Neither do we need to know the contents of f to discuss the code that the compiler generates in this case. I deliberately left f undefined so that loop efficiency can be studied in isolation.
If you don't write something the compiler could inline,I wouldn't worry about things that are on the order of a subroutine call.
Furthermore, if you do write something inlineable, the compiler may be able to dispense with additional overhead from BOOST_FOREACH that cannot be legally removed without knowing the full loop body. -- Dave Abrahams Boost Consulting http://www.boost-consulting.com