Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2005-09-20 11:52:13

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.

Boost list run by bdawes at, gregod at, cpdaniel at, john at