$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
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