Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r77153 - sandbox-branches/optional_optimization/boost/optional
From: C.Hite_at_[hidden]
Date: 2012-03-02 11:38:59


Author: chris_hite
Date: 2012-03-02 11:38:58 EST (Fri, 02 Mar 2012)
New Revision: 77153
URL: http://svn.boost.org/trac/boost/changeset/77153

Log:
move m_initialized = false ; to destroy()
Text files modified:
   sandbox-branches/optional_optimization/boost/optional/optional.hpp | 10 ++++++----
   1 files changed, 6 insertions(+), 4 deletions(-)

Modified: sandbox-branches/optional_optimization/boost/optional/optional.hpp
==============================================================================
--- sandbox-branches/optional_optimization/boost/optional/optional.hpp (original)
+++ sandbox-branches/optional_optimization/boost/optional/optional.hpp 2012-03-02 11:38:58 EST (Fri, 02 Mar 2012)
@@ -435,8 +435,10 @@
 
     void destroy()
     {
- if ( m_initialized )
+ if ( m_initialized ){
         destroy_impl(is_reference_predicate()) ;
+ m_initialized = false ;
+ }
     }
 
     unspecified_bool_type safe_bool() const { return m_initialized ? &this_type::is_initialized : 0 ; }
@@ -474,12 +476,12 @@
     reference_type dereference( internal_type* p, is_reference_tag ) { return p->get() ; }
 
 #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x581))
- void destroy_impl ( is_not_reference_tag ) { get_ptr_impl()->internal_type::~internal_type() ; m_initialized = false ; }
+ void destroy_impl ( is_not_reference_tag ) { get_ptr_impl()->internal_type::~internal_type() ; }
 #else
- void destroy_impl ( is_not_reference_tag ) { get_ptr_impl()->T::~T() ; m_initialized = false ; }
+ void destroy_impl ( is_not_reference_tag ) { get_ptr_impl()->T::~T() ; }
 #endif
 
- void destroy_impl ( is_reference_tag ) { m_initialized = false ; }
+ void destroy_impl ( is_reference_tag ) { }
 
     // If T is of reference type, trying to get a pointer to the held value must result in a compile-time error.
     // Decent compilers should disallow conversions from reference_content<T>* to T*, but just in case,


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk