|
Boost : |
From: Doug Gregor (gregod_at_[hidden])
Date: 2001-01-20 21:40:39
Hello all,
The Boost "callback" library seemed to die in committee last time, so I
thought I'd bring another prototype to the table in the hope of getting some
agreement on the issue. The new prototype is at
http://www.egroups.com/files/boost/Callback/any_func.zip
Some quick comments/justifications are in order:
- It is called "any_function" because there seemed to be no name consensus
("callback" was too limiting, "event" wasn't correct, "function_ptr" seems -
to me - like it sounds limiting) and I don't recall anyone openly disagreeing
with "any_function".
- It uses cloning. The general consensus seemed to be leaning toward cloning.
- No virtual functions are used. Instead, static member functions are used to
dispatch the calls to their targets to keep it typesafe.
I've tested it on MSVC++ 6.0sp4 and GCC 2.95.2. The only difference is in
initialization:
any_function<int, int, int> f1 = plus<int>(); // 1
any_function<int, int, int> f2 (plus<int>()); // 2
VC++ can handle 2 but not 1; GCC can handle 1 but not 2 :)
Doug
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk