[function] setting a function from within a call on the function?
Hi guys, ran across a question that I'd have thought would be at least common enough to get a note in the docs, but I can't find it there. Is it safe to set a function from within a call on the function? boost::function<void()> f; void func2(); void func1() { f = func2; } void main() { f = func1; f(); } -- Cory
On Mar 6, 2008, at 5:18 AM, Cory Nelson wrote:
Hi guys, ran across a question that I'd have thought would be at least common enough to get a note in the docs, but I can't find it there.
Is it safe to set a function from within a call on the function?
boost::function<void()> f;
void func2();
void func1() { f = func2; }
void main() { f = func1; f(); }
As long as the function object being called by the boost::function doesn't mind having its state disappear, it's fine. - Doug
participants (2)
-
Cory Nelson
-
Doug Gregor