|
Boost Users : |
Subject: [Boost-users] [Function] Encapsulated inside a class, won't initialize.
From: Ravey Alexandre (alexandre.ravey_at_[hidden])
Date: 2008-10-12 19:46:40
Hi there,
I'm using boost::function defined private inside a class and then assign a
function comming from another boost::function. But it don't work.
A little code may help understand my pretty bad explanation.
#######
class C
{
public:
void Bind(boost::function<void()> f);
private:
boost::function<void()> func;
};
void C::Bind(boost::function<void()> f)
{
func = f; //Compile, but raise an access violation.
}
#######
The problem seems obvious to me, func si not initialized correctly and
swap() fail.
But I can't figure out how to make this work.
Thanks for your help.
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