Using gcc's typeof and boost.lambda together.
I was just playing around with the boost.lambda library and thought of playing a bit with it using gcc's typeof extension... this is the code I used (just slightly modified documentation code): typedef typeof(_1 = 1) assign_one; list<int> v(10); for_each(v.begin(), v.end(), assign_one()); I was hoping it would work the same as the documentation's code, but instead it generates a few big errors about lambda_functor_base<...>::lambda_functor_base() not existing. I know typeof is a gnu extension and it's not really portable to use it in code, but does anyone have any ideas of how to get something like this to work correctly? -jivera
From: "Matthew Dempsky"
I was just playing around with the boost.lambda library and thought of playing a bit with it using gcc's typeof extension... this is the code I used (just slightly modified documentation code):
typedef typeof(_1 = 1) assign_one; list<int> v(10); for_each(v.begin(), v.end(), assign_one());
Perhaps typeof(_1 = 1) assign_one(_1 = 1); will work?
participants (2)
-
Matthew Dempsky
-
Peter Dimov