mirror of
https://github.com/boostorg/utility.git
synced 2025-05-09 23:14:02 +00:00
Optional's Assignment fixed
[SVN r28412]
This commit is contained in:
parent
aca7699046
commit
5ca5b4102b
@ -117,9 +117,6 @@ From the user POV, it amounts to creating the right factory object to hold the p
|
|||||||
The following simplified example shows the basic idea. A complete example follows the formal specification of the framework:</p>
|
The following simplified example shows the basic idea. A complete example follows the formal specification of the framework:</p>
|
||||||
<pre>struct C
|
<pre>struct C
|
||||||
{
|
{
|
||||||
C() : contained_(0) {}
|
|
||||||
C ( X const& v ) : contained_ ( new X(v) ) {}
|
|
||||||
|
|
||||||
template<class InPlaceFactory>
|
template<class InPlaceFactory>
|
||||||
C ( InPlaceFactory const& aFactoty )
|
C ( InPlaceFactory const& aFactoty )
|
||||||
:
|
:
|
||||||
@ -128,11 +125,15 @@ The following simplified example shows the basic idea. A complete example follow
|
|||||||
aFactory.template apply<X>(contained_);
|
aFactory.template apply<X>(contained_);
|
||||||
}
|
}
|
||||||
|
|
||||||
~C() { delete contained_ ; }
|
~C()
|
||||||
|
{
|
||||||
|
contained_ -> X::~X();
|
||||||
|
delete[] contained_ ;
|
||||||
|
}
|
||||||
|
|
||||||
X* uninitialized_storage() { return static_cast<X*>(new char[sizeof(X)]) ; }
|
char* uninitialized_storage() { return new char[sizeof(X)] ; }
|
||||||
|
|
||||||
X* contained_ ;
|
char* contained_ ;
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
void foo()
|
void foo()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user