|
Boost : |
From: William E. Kempf (williamkempf_at_[hidden])
Date: 2002-08-07 08:54:56
----- Original Message -----
From: "Andrew J Bromage" <ajb_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Tuesday, August 06, 2002 7:50 PM
Subject: Re: [boost] Enhanced call_once()
> G'day all.
>
> In retrospect I shouldn't have brought up a "more powerful"
> call_once function, because that's not what I want at all. What
> I "really" want is this:
>
> class once
> {
> public:
> once();
> ~once();
> call_once(function0<void>&);
> };
Since call_once relies on static initialization the type has to be POD,
which means it would be more like this:
class once
{
public:
typedef ... flag_type;
flag_type flag;
call_once(function0<void>&);
};
boost::once once = BOOST_ONCE_INIT;
once.call_once(&foo);
So you change the syntax slightly, but that's about all.
Again, I'd love to be proven wrong about the POD requirements and would love
to see any implementation that would work with out it.
Bill Kempf
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk