Re: [boost] Enhanced call_once()
by Andrew J Bromage other posts by this author
Aug 7 2002 12:50AM messages near this date
Re: [boost] Enhanced call_once()
|
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> &);
};
On Tue, Aug 06, 2002 at 09:13:26AM -0400, Pete Becker wrote:
> The one place where they seem useful is in lazy initialization. But rather
> than thinking in C terms and prolonging the life of the inside-out
> interface to once functions, think C++ and design a more suitable solution:
>
> class lazy_initializer
> {
> public:
> lazy_initializer();
> ~lazy_initializer();
> void init_once();
> private:
> virtual void do_init() = 0;
> };
This is in fact exactly what I wanted to use the once operation for,
except that my class needs more than one piece of data which is lazily
evaluated. Admittedly composing with more than one lazy_initializer
class would work, but it seems less clean than just dropping a few once
objects into the class.
Cheers,
Andrew Bromage
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Thread:
Andrew J Bromage
Peter Dimov
Andrew J Bromage
William E. Kempf
Andrew J Bromage
William E. Kempf
Alexander Terekhov
Pete Becker
Andrew J Bromage
Peter Dimov
Andrew J Bromage
William E. Kempf
Andrew J Bromage
William E. Kempf
Rene Rivera
William E. Kempf
Andrew J Bromage
Jason Stewart
Andrew J Bromage
Andrew J Bromage
Rob Stewart
William E. Kempf
William E. Kempf
Alexander Terekhov
Peter Dimov
Peter Dimov
Pete Becker
William E. Kempf
William E. Kempf
Pete Becker
|