Greg Underwood on 30 Jul 2003 06:46:30 -0000 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: [ALACPP] boost::function shortcoming |
On Tuesday 29 July 2003 04:52 pm, Christopher Smith wrote: > We talked about this at our last meeting didn't we? Oh wait, you weren't > there..... ;-) > > On Tue, 2003-07-29 at 16:39, Gavin Doughtie wrote: > > So, I was wondering if there was a way to compare two boost::function > > objects to see if they were bound to the same function. Greg, quite > > sensibly, wanted a unit test to ensure that the default bindings were > > correct, and there was no way that we could find to dig the original > > function pointer out and check it. > > Of course another approach is to make a dummy function that just toggles > a flag if it is called, and then test if boost::function invokes that > function. But that's not what I want to test. That just tells me that the over-all system works, that I can assign an arbitrary function to the boost::function<...> magic. What I want to test is if a particular function was in fact assigned to a particular boost::function<...> foo;. IE: foo == funcptr;. Without the ability to do that, I have to form the oppinion that this feature of boost is rather under-implemented. > > Fortunately, in this case we were able to use a raw function pointer, but > > it begs the question -- I could see not comparing two boost::bound > > function objects as the member instances might be different, but even > > then I'd like to do some kind of type checking. > > Given that operator== is deliberately left undefined, and the way they > are doing their abstraction, I can't see a way to do what you want. Gavin and I spent some time looking at the docs but didn't come to an understanding of why they deliberatly left == undefined... anyone care to clarify? They said something about some sort of loophole caused by the safe_bool()? -Greg _______________________________________________ alacpp mailing list alacpp@xxxxxxxxxxx http://lists.ellipsis.cx/mailman/listinfo/alacpp