"Philippe A. Bouchard" <[EMAIL PROTECTED]> 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 _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost