$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
From: Olaf Krzikalla (krzikalla_at_[hidden])
Date: 2008-05-30 10:09:09
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