|
Boost Users : |
Subject: Re: [Boost-users] Please help make this boost::bind example compile
From: Chris Stankevitz (chrisstankevitz_at_[hidden])
Date: 2013-02-26 23:29:00
On Tue, Feb 26, 2013 at 8:06 PM, Chris Stankevitz
<chrisstankevitz_at_[hidden]> wrote:
> boost::function<int&(TCObject*)> GetFunctionThatReturnsRefX_2()
> {
> return boost::bind(&TCObject::x, _1);
> }
Solution:
Bind takes a template argument that is the return type when using class members:
boost::function<int&(TCObject*)> GetFunctionThatReturnsRefX_2()
{
return boost::bind<int&>(&TCObject::x, _1);
}
Chris
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