Boost logo

Boost :

From: Fernando Cacciola \(Home\) (fernando_cacciola_at_[hidden])
Date: 2003-02-24 15:22:45


----- Original Message -----
From: "Philippe A. Bouchard" <philippeb_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Monday, February 24, 2003 4:29 PM
Subject: [boost] Re: Re: Re: partial<> proposal

> David Abrahams wrote:
>
> [...]
>
> >> 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?
>
> Because optional<> will be able to handle types without copy constructors
> (this was the main purpose of partial<> in fact). I was referring to the
> copy constructor of optional<>'s template parameter.
>
I'm still not sure I understand what are you trying to do, but it looks
like you want optional with in-place construction (which bypasses the copy).
In this case, I recently explored something which would look like:

optional<Window> opt( in_place<Window>(point(0,0),point(10,10)));

here, in_place() is used to forward T's ctor argument to optional<> so that
T is effectively constructed in-place right within the aligned storage.

Is this what you want?

Fernando Cacciola


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk