
23 Jul
2008
23 Jul
'08
11:29 p.m.
AMDG Mathias Gaunard wrote:
So (if I understand you correctly), you want not function-pointer behaviour, but something more like reference - have to be initialized, cannot be null?
Well yeah, preventing an "empty" state means that you have to initialize the thing, it cannot be null. That's what the whole thread is about.
I don't think that boost::function should provide a never empty guarantee for several technical reasons: a) Providing the guarantee has a runtime cost. Allowing empty Boost.Function objects is free. b) Looking forward to C++0x, it is impossible to implement a no throw move for objects than have no empty state. c) Objects that provide default constructors are easier to work with. In Christ, Steven Watanabe