
1 Dec
2010
1 Dec
'10
5:46 p.m.
How can I write an inline nullary function object, returning a fixed value? The equivalent of this... int x = 4; int f( ) { return x; } boost::function<int()> g = f; but without defining the intermediate f()? I thought this might work... boost::function<int()> g = bind(bind(apply<int>(), _1 ), x ); but maybe I've not got it quite right? Thx - Rob.