
8 May
2004
8 May
'04
10:06 a.m.
Rainer Deyke wrote:
David Abrahams wrote:
Err, this could only work if you were willing to pass the loop block to the macro. Might be worth the pain, though (?)
If you are willing to pass the loop body to the macro, you don't need the inner for loop at all.
That's all true, but IMO it isn't worth the pain. I'm OK with BOOST_FOREAH being 4% slower than a hand-coded loop on average (until compilers get better flow control analysis). In exchange, users get a nice, first-class feel. It behaves like a new keyword instead of a macro, which is intended. It's certainly a judgement call, but the perf/usability trade-off was a conscious one. The tiny perf hit seems a small price. -- Eric Niebler Boost Consulting www.boost-consulting.com