|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r71348 - sandbox/shifted_ptr/boost
From: phil_at_[hidden]
Date: 2011-04-17 03:16:51
Author: pbouchard
Date: 2011-04-17 03:16:50 EDT (Sun, 17 Apr 2011)
New Revision: 71348
URL: http://svn.boost.org/trac/boost/changeset/71348
Log:
* Fixed important set union bug
Text files modified:
sandbox/shifted_ptr/boost/shifted_ptr.hpp | 27 ++++++++++++++-------------
1 files changed, 14 insertions(+), 13 deletions(-)
Modified: sandbox/shifted_ptr/boost/shifted_ptr.hpp
==============================================================================
--- sandbox/shifted_ptr/boost/shifted_ptr.hpp (original)
+++ sandbox/shifted_ptr/boost/shifted_ptr.hpp 2011-04-17 03:16:50 EDT (Sun, 17 Apr 2011)
@@ -29,6 +29,7 @@
#include <new.h>
#endif
+#include <iostream>
#include <boost/pool/pool_alloc.hpp>
#include <boost/type_traits/add_pointer.hpp>
@@ -79,7 +80,7 @@
{
includes_.push_back(& tag_);
}
-
+
/**
Release of a @c set with possible destruction of all its elements and other @c set s unified to it.
@@ -306,13 +307,11 @@
template <typename V>
shifted_ptr & operator = (shifted<V> * p)
{
- if (ps_ && ! owned_base::pool_.is_from(ps_))
- {
- if (! owned_base::pool_.is_from(this))
- release(false);
+ if (! owned_base::pool_.is_from(this))
+ release(false);
+
+ init(p);
- init(p);
- }
base::operator = (p);
return * this;
@@ -328,12 +327,11 @@
template <typename V>
shifted_ptr & operator = (shifted_ptr<V> const & p)
{
- if (ps_ && ! owned_base::pool_.is_from(ps_))
- if (ps_->redir() != p.ps_->redir())
- {
- release(false);
- ps_->redir(p.ps_);
- }
+ if (ps_->redir() != p.ps_->redir())
+ {
+ release(false);
+ ps_->redir(p.ps_);
+ }
base::operator = (p);
return * this;
@@ -377,7 +375,10 @@
base::po_ = 0;
if (! d)
+ {
+ ps_->set::~set();
new (ps_) set();
+ }
else
delete ps_;
}
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