|
Boost : |
From: Beman Dawes (bdawes_at_[hidden])
Date: 2001-07-20 13:01:13
At 01:33 PM 7/20/2001, Greg Colvin wrote:
>I notice that http://users.utu.fi/sisasa/oasis/cppfaq/ctors.html#[10.10]
>recommends the following idiom:
>
> Fred& x()
> {
> static Fred* ans = new Fred();
> return *ans;
> }
>
>when I would have expected
>
> Fred& x()
> {
> static Fred ans;
> return ans;
> }
>
>or am I missing something (as usual)?
Ask Jerry Schwarz. Isn't he the world's leading expert on static
initialization tricks:-?
--Beman
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk