
30 May
2008
30 May
'08
2:09 p.m.
Hi, is it possible to check a function bound to boost::function, if a particular argument is actually needed? Example: ---- struct bar {}; typedef boost::function<void(int, bar&)> tSlot; void foo(tSlot& s); void barNeeded(int, bar&); void barNeeded(int); void callfoo() { foo(boost::bind(&barNeeded, _1, _2)); foo(boost::bind(&barNotNeeded, _1)); } void foo(tSlot& s) { bar b; expensive_calculation(b); s(1, b); } ---- How can I prevent expensive_calculation if the function barNotNeeded was bound to tSlot? Best regards Olaf Krzikalla