|
Boost : |
From: David Abrahams (dave_at_[hidden])
Date: 2003-09-29 16:42:13
Brian McNamara <lorgon_at_[hidden]> writes:
> As a final aside, would that we could write
>
> uninitialized Foo foo; // new keyword
> // call placement new to construct the object later
>
> to mean
>
> unsigned char bits[ sizeof(Foo) ]; // suitably aligned
> Foo& foo = *( (Foo*)( (void*)(bits) ) ); // cast the bits
> // call placement new to construct the object later
>
> in C++! I hate having to "hack at the system level" to do something
> which can be expressed more simply at the language level.
Have you seen the Boost optional library?
Maybe we need a backdoor for placement new in that library?
-- Dave Abrahams Boost Consulting www.boost-consulting.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk