Boost logo

Boost :

Subject: Re: [boost] [function] Documentation suggestion (FAQ)
From: Cromwell Enage (sponage_at_[hidden])
Date: 2013-02-04 00:52:47


Evan Driscoll wrote: > In other words, I was doing >    void backing_func() {...} >    boost::function<void()> func(backing_func); >  >    void foo(function<void()> callback) { >        if (callback == func) { >            fast_foo(); >        } else { >            slow_foo(callback); >        } >    } > but by changing the if statement condition to >     if (callback == &backing_func) > everything is fine and dandy. >  >  > My suggestion is that the FAQ entry at > http://www.boost.org/doc/libs/1_52_0/doc/html/function/faq.html > should be updated to point out that there IS a way to do this > specific case.  If everyone read the whole docs and remembered > them perfectly this wouldn't be a problem, but of course those > statements are probably true of exactly no one. :-) I stumbled > across the FAQ entry, which I feel strongly suggests that what I > want to do is impossible. I usually read the tutorials before the FAQ.  I found your specific case here: <http://www.boost.org/doc/libs/1_53_0/doc/html/function/tutorial.html#idp58429792>  That section describes the types of functions against which a boost::function is equality-comparable. A little repetition might not hurt in this case, though. Cromwell D. Enage


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk