"Philippe A. Bouchard" <[EMAIL PROTECTED]> writes:

> Maybe the following placement operator new can help prevent copy constructor
> usages:
> #include <new>
>
> template <typename T>
>     class optional
>     {
>         friend void * operator new (size_t, optional<T> &);
>
>         ...
>     };
>
> template <typename T>
>     inline void * operator new (size_t a_s, boost::optional<T> & a_o)
>     {
>         a_o.m_initialized = true;
>         return operator new (a_s, a_o.get());
>     }
>
> Example:
> optional<int> i;
>
> new (i) int(17);

Which copy ctor are you referring to?
And why do we want to prevent copy ctor usages?

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to