Boost logo

Boost-Commit :

From: phil_at_[hidden]
Date: 2008-06-09 04:39:13


Author: pbouchard
Date: 2008-06-09 04:39:13 EDT (Mon, 09 Jun 2008)
New Revision: 46271
URL: http://svn.boost.org/trac/boost/changeset/46271

Log:
Added PPT presentation and removed useless shifted_ptr template parameter.
Added:
   sandbox/shifted_ptr/libs/smart_ptr/doc/ShiftedPointer.ppt (contents, props changed)
Text files modified:
   sandbox/shifted_ptr/boost/detail/sh_owned_base_nt.hpp | 19 ++++++++++++++-----
   sandbox/shifted_ptr/boost/shifted_ptr.hpp | 25 +++++++++++++------------
   2 files changed, 27 insertions(+), 17 deletions(-)

Modified: sandbox/shifted_ptr/boost/detail/sh_owned_base_nt.hpp
==============================================================================
--- sandbox/shifted_ptr/boost/detail/sh_owned_base_nt.hpp (original)
+++ sandbox/shifted_ptr/boost/detail/sh_owned_base_nt.hpp 2008-06-09 04:39:13 EDT (Mon, 09 Jun 2008)
@@ -67,7 +67,7 @@
     Syntax helper.
 */
 
-typedef std::list< numeric::interval<int>, fast_pool_allocator< numeric::interval<int> > > pool_lii;
+typedef std::list< numeric::interval<unsigned>, fast_pool_allocator< numeric::interval<unsigned> > > pool_lii;
 
 
 /**
@@ -91,7 +91,7 @@
         pool_lii::reverse_iterator i;
         
         for (i = get()->rbegin(); i != get()->rend(); i ++)
- if (in((int)(p), * i))
+ if (in((unsigned)(p), * i))
                 break;
 
         get()->erase(i.base(), get()->end());
@@ -103,7 +103,7 @@
     {
         void * p = ordered_malloc(s);
         
- get()->push_back(numeric::interval<int>((int) p, int((char *)(p) + s)));
+ get()->push_back(numeric::interval<unsigned>((unsigned) p, unsigned((char *)(p) + s)));
         
         return p;
     }
@@ -113,7 +113,7 @@
         pool_lii::reverse_iterator i;
         
         for (i = get()->rbegin(); i != get()->rend(); i ++)
- if (in((int)(p), * i))
+ if (in((unsigned)(p), * i))
                 break;
         
         get()->erase(i.base(), get()->end());
@@ -122,12 +122,17 @@
 };
 
 
+template <typename T>
+ class shifted_allocator;
+
 /**
         Root class of all pointees.
 */
 
 class owned_base : public sp_counted_base
 {
+ template <typename U> friend class shifted_allocator;
+
         intrusive_stack ptrs_;
         intrusive_list inits_;
         
@@ -146,6 +151,10 @@
     intrusive_list::node * init_tag() { return & init_tag_; }
 
     static pool pool_;
+
+private:
+ virtual void dispose() {} // dummy
+ virtual void * get_deleter( std::type_info const & ti ) {} // dummy
 };
 
 
@@ -314,7 +323,7 @@
 
         pointer allocate(size_type s, const void * = 0)
         {
- shifted<T> * q = shifted<T>::operator new(s * sizeof(T));
+ void * q = shifted<T>::operator new(s * sizeof(T));
             
             // only T's constructor will be called so take care of the rest
             return static_cast<shifted<T> *>(new (q) owned_base)->element();

Modified: sandbox/shifted_ptr/boost/shifted_ptr.hpp
==============================================================================
--- sandbox/shifted_ptr/boost/shifted_ptr.hpp (original)
+++ sandbox/shifted_ptr/boost/shifted_ptr.hpp 2008-06-09 04:39:13 EDT (Mon, 09 Jun 2008)
@@ -145,12 +145,13 @@
         Deterministic memory manager of constant complexity.
 */
 
-template <typename T, template <typename> class U = shifted_ptr_base>
- class shifted_ptr : public U<T>
+template <typename T>
+ class shifted_ptr : public shifted_ptr_base<T>
     {
         //template <typename, template <typename> class> friend class shifted_ptr;
+ typedef shifted_ptr_base<T> base;
 
- using U<T>::share;
+ using base::share;
 
 
         union
@@ -172,7 +173,7 @@
         }
 
         template <typename V>
- shifted_ptr(shifted<V> * p) : U<T>(p)
+ shifted_ptr(shifted<V> * p) : base(p)
             {
                 if (! owned_base::pool_.is_from(this))
                 {
@@ -188,7 +189,7 @@
             }
 
         template <typename V>
- shifted_ptr(shifted_ptr<V> const & p) : U<T>(p)
+ shifted_ptr(shifted_ptr<V> const & p) : base(p)
             {
                 if (! owned_base::pool_.is_from(this))
                     ps_ = new set();
@@ -198,7 +199,7 @@
                 ps_->redir(p.ps_);
             }
 
- shifted_ptr(shifted_ptr<T> const & p) : U<T>(p)
+ shifted_ptr(shifted_ptr<T> const & p) : base(p)
             {
                 if (! owned_base::pool_.is_from(this))
                     ps_ = new set();
@@ -213,7 +214,7 @@
             {
                 release();
                 init(p);
- U<T>::operator = (p);
+ base::operator = (p);
 
                 return * this;
             }
@@ -221,14 +222,14 @@
         template <typename V>
             shifted_ptr & operator = (shifted_ptr<V> const & p)
             {
- if (p.po_ != U<T>::po_)
+ if (p.po_ != base::po_)
                 {
                     if (ps_->redir() != p.ps_->redir())
                     {
                         release();
                         ps_->redir(p.ps_);
                     }
- U<T>::operator = (p);
+ base::operator = (p);
                 }
                 return * this;
             }
@@ -255,7 +256,7 @@
             {
                 if (ps_->release())
                 {
- U<T>::po_ = 0;
+ base::po_ = 0;
 
                     if (! d)
                         new (ps_) set();
@@ -264,14 +265,14 @@
                 }
                 else
                 {
- U<T>::reset();
+ base::reset();
 
                     if (! d)
                         ps_ = new set();
                 }
             }
             else if (! d)
- U<T>::reset();
+ base::reset();
         }
 
         void init(owned_base * p)

Added: sandbox/shifted_ptr/libs/smart_ptr/doc/ShiftedPointer.ppt
==============================================================================
Binary file. No diff available.


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