Boost logo

Boost :

Subject: Re: [boost] [optional] layout
From: Domagoj Saric (dsaritz_at_[hidden])
Date: 2009-11-01 18:36:06


"Mathias Gaunard" <mathias.gaunard_at_[hidden]> wrote in message
news:hca1im$v6k$1_at_ger.gmane.org...
> shared_ptr already provides delayed construction, I don't see why you would
> want to use optional here?
> Because you want to store the memory in static memory maybe? For that, just
> use boost::aligned_storage and placement new, works with shared_ptr like the
> rest just fine.

sorry..i'll respond only to this last point (for the sake of a clearer
discussion) because it actually contains the main issue (my code 'wish')...
...yes :) aligned_storage and placement new (plus the few additional
workarounds for 'quirky' cases) are exactly/all i want...but because it is a
relatively often used idiom i would like not to have to write it all manually
every time...but rather have small class that wraps it up and allows me to call
construct() and destruct() (with boost::in_place support and even the 'bool'
left in debug builds for asserting correct usage)...

-- 
 "That men do not learn very much from the lessons of history is the most
important of all the lessons of history."
 Aldous Huxley 

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