Self-inlining anonymous closures in C++
matt.might.net
Self-inlining anonymous closures in C++
1–9 of 9 posts
Re: Self-inlining anonymous closures in C++
#2http://www.boost.org/doc/libs/1_44_0/libs/spirit/phoenix/doc...
Re: Self-inlining anonymous closures in C++
#3Sorry, I can't see how this is an improvement over Boost::Phoenix: http://www.boost.org/doc/libs/1_44_0/libs/spirit/phoenix/doc...
Re: Self-inlining anonymous closures in C++
#4Re: Self-inlining anonymous closures in C++
#5Re: Self-inlining anonymous closures in C++
#6The reality is that that kind of technique allows to produce extremely fast code because the compiler has got so much "certain" information at compile time that it can optimize very aggressively.
It's more powerful than vanilla C macros because it works with the compiler, not the pre-processor.
Re: Self-inlining anonymous closures in C++
#7A lot of people will read this and think "damn C++ is such an ugly language, it should never allow the programmer to do this!". The reality is that that kind of technique allows to produce extremely fast code because the compiler has got so much "certain" information at compile time that it can optimize very aggressively. It's more powerful than vanilla C macros because it works with the compiler, not the pre-process…
YMMV whether that's a blessing or a curse, though!
Re: Self-inlining anonymous closures in C++
#8$ in C++ identifiers is a nonstandard extension that gcc allows on some platforms - cool (and not portable).
Re: Self-inlining anonymous closures in C++
#9Sorry, I can't see how this is an improvement over Boost::Phoenix: http://www.boost.org/doc/libs/1_44_0/libs/spirit/phoenix/doc...
It's just a tutorial on how such things are done. :)