$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: David Abrahams (dave_at_[hidden])
Date: 2003-02-24 13:05:23
"Philippe A. Bouchard" <philippeb_at_[hidden]> 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