|
Boost Users : |
Subject: Re: [Boost-users] Why is cref required in this nested bind example?
From: Chris Stankevitz (chrisstankevitz_at_[hidden])
Date: 2012-12-04 20:08:17
On Tue, Dec 4, 2012 at 4:20 PM, Steve Lorimer <steve.lorimer_at_[hidden]> wrote:
> Try call the result:
Steve,
Thank you. That was pretty boneheaded of me to leave out. Another
way to get the compiler failure is to just store the result:
//function<void()> x = bind(b, bind(a));
function<void()> x = bind(b, cref(bind(a)));
I will paste the corrected demo below.
Thank you,
Chris
===
#include <boost/bind.hpp>
#include <boost/function.hpp>
using boost::bind;
using boost::cref;
using boost::function;
void a()
{
}
void b(function<void()>)
{
}
void f()
{
//function<void()> x = bind(b, bind(a));
function<void()> x = bind(b, cref(bind(a)));
}
===
$ g++ --version
g++ (Gentoo 4.5.4 p1.0, pie-0.4.7) 4.5.4
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net