Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2003-02-24 13:03:50


"Philippe A. Bouchard" <philippeb_at_[hidden]> writes:

> Philippe A. Bouchard wrote:
>
> [...]
>
>> Example:
>> optional<int> i;
>>
>> new (i) int(17);
>
>
> Ex. 1:
> // Class Widget has a heavy copy constructor
> optional<Widget> i;
>
> new (i) Widget(this, ...);

Soo... what are you demonstrating here? Please spell it out. Normal
construction of a widget in optional<Widget> incurs a copy?
>
>
> Ex. 2:
> // The object A is aligned like a char
> struct A
> {
> char c_;
>
> A() : c_('\0') {}
> A(char a_c) : c_(a_c) {}
> };
>
> optional<char> array[50];
>
> for (int i = 0; i < 50; ++ i)
> {
> new (array[i]) A(' ');
> }

Soo... what are you demonstrating here? Please spell it out. The
bool in optional that indicates initialization incurs space/alignment
overhead?

-- 
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