
20 Sep
2005
20 Sep
'05
4:52 p.m.
John Maddock wrote:
Me neither, and I still don't see what having a return value really gains us in this case (I would much rather be able to pass parameters to the call_once procedure, but that's a whole other ball game).
With a call_once taking a function object, you can use boost::bind for parameter passing. I can see one immediate use for a return value, instead of X * px; void init_px(); int main() { call_once( init_px ); // use px } one might use X * init_px(); int main() { X * px = call_once( init_px ); // use px } (and similarly with a reference.) I can't think of a compelling example that returns an X by value.