$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: Peter Dimov (pdimov_at_[hidden])
Date: 2004-03-03 17:50:41
Powell, Gary wrote:
>
> In my plan, variables would have same scope in a function as they do
> now. i.e. variables local to std::accumulate are not visible in the
> anonymous fn. And yes its not a panacea. For instance, what about
> static variables in an anonymous function.
The basic question is do you bind by value or by reference?
int f(std::vector<int> const & v)
{
int n = 0;
for_each( v.begin(), v.end(), void(int const & x) { n += x; } );
return n;
}
function<int()> g(int n)
{
return int() { return n; };
}