Boost logo

Boost-Commit :

From: phil_at_[hidden]
Date: 2008-06-20 04:04:51


Author: pbouchard
Date: 2008-06-20 04:04:49 EDT (Fri, 20 Jun 2008)
New Revision: 46548
URL: http://svn.boost.org/trac/boost/changeset/46548

Log:
How shifted_allocator should look like.
Text files modified:
   sandbox/shifted_ptr/boost/detail/shifted_ptr_base.hpp | 30 ++++++++++++++++++++++++++++++
   sandbox/shifted_ptr/boost/shifted_allocator.hpp | 5 ++---
   sandbox/shifted_ptr/boost/shifted_ptr.hpp | 17 +----------------
   sandbox/shifted_ptr/libs/smart_ptr/example/shifted_ptr_test2.cpp | 4 ++--
   4 files changed, 35 insertions(+), 21 deletions(-)

Modified: sandbox/shifted_ptr/boost/detail/shifted_ptr_base.hpp
==============================================================================
--- sandbox/shifted_ptr/boost/detail/shifted_ptr_base.hpp (original)
+++ sandbox/shifted_ptr/boost/detail/shifted_ptr_base.hpp 2008-06-20 04:04:49 EDT (Fri, 20 Jun 2008)
@@ -112,6 +112,16 @@
                         }
                         return po_;
                 }
+
+ bool operator == (shifted_ptr_base<element_type> const & p) const
+ {
+ return po_ == p.po_;
+ }
+
+ bool operator != (shifted_ptr_base<element_type> const & p) const
+ {
+ return po_ != p.po_;
+ }
 
                 void reset(element_type * p = 0)
                 {
@@ -215,6 +225,16 @@
                         }
                         return po_;
                 }
+
+ bool operator == (shifted_ptr_base<element_type> const & p) const
+ {
+ return po_ == p.po_;
+ }
+
+ bool operator != (shifted_ptr_base<element_type> const & p) const
+ {
+ return po_ != p.po_;
+ }
 
                 void reset(element_type * p = 0)
                 {
@@ -307,6 +327,16 @@
                         }
                         return po_;
                 }
+
+ bool operator == (shifted_ptr_base<element_type> const & p) const
+ {
+ return po_ == p.po_;
+ }
+
+ bool operator != (shifted_ptr_base<element_type> const & p) const
+ {
+ return po_ != p.po_;
+ }
 
                 void reset(element_type * p = 0)
                 {

Modified: sandbox/shifted_ptr/boost/shifted_allocator.hpp
==============================================================================
--- sandbox/shifted_ptr/boost/shifted_allocator.hpp (original)
+++ sandbox/shifted_ptr/boost/shifted_allocator.hpp 2008-06-20 04:04:49 EDT (Fri, 20 Jun 2008)
@@ -40,8 +40,8 @@
     public:
         typedef size_t size_type;
         typedef ptrdiff_t difference_type;
- typedef shifted_ptr<T> pointer;
- typedef const shifted_ptr<T> const_pointer;
+ typedef shifted<T> * pointer;
+ typedef const shifted<T> * const_pointer;
         typedef shifted<T> & reference;
         typedef const shifted<T> & const_reference;
         typedef shifted<T> value_type;
@@ -103,5 +103,4 @@
 
 } // namespace boost
 
-
 #endif // #ifndef BOOST_SHIFTED_ALLOCATOR_HPP_INCLUDED

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-20 04:04:49 EDT (Fri, 20 Jun 2008)
@@ -21,6 +21,7 @@
 #ifndef BOOST_DETAIL_SH_RTCMM_H_INCLUDED
 #define BOOST_DETAIL_SH_RTCMM_H_INCLUDED
 
+#include <iterator>
 
 #if defined(_MSC_VER)
 #pragma warning( push )
@@ -163,19 +164,6 @@
     public:
         typedef T element_type;
 
-/*
- //! FIXME
- typedef iterator_category;
- typedef value_type;
- typedef difference_type;
- typedef reference;
- typedef pointer;
- typedef reference;
- typedef pointer;
- typedef reference;
-*/
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
 
         shifted_ptr() : ps_(0)
         {
@@ -291,10 +279,7 @@
         void init(owned_base * p)
         {
             for (intrusive_list::iterator<owned_base, & owned_base::init_tag_> i = p->inits()->begin(), j; j = i, ++ j, i != p->inits()->end(); i = j)
- //for (pool::lpp::iterator i = owned_base::pool_.construct().begin(); i != owned_base::pool_.construct().end(); i ++)
             {
- //owned_base * q = reinterpret_cast<owned_base *>(i->first);
-
                 ps_->elements()->push_back(i->set_tag());
                 
                 for (intrusive_stack::iterator<shifted_ptr, & shifted_ptr::pn_> m = p->ptrs()->begin(), n; n = m, ++ n, m != p->ptrs()->end(); m = n)

Modified: sandbox/shifted_ptr/libs/smart_ptr/example/shifted_ptr_test2.cpp
==============================================================================
--- sandbox/shifted_ptr/libs/smart_ptr/example/shifted_ptr_test2.cpp (original)
+++ sandbox/shifted_ptr/libs/smart_ptr/example/shifted_ptr_test2.cpp 2008-06-20 04:04:49 EDT (Fri, 20 Jun 2008)
@@ -64,8 +64,8 @@
     vector() { ++count; }
     ~vector() { --count; }
     vector(const vector& other) : elements(other.elements) { ++count; }
- std::vector<shifted_ptr<vector> > elements;
- //std::vector<shifted_ptr<vector>, shifted_allocator< shifted_ptr<vector> > > elements; //! FIXME
+ //std::vector<shifted_ptr<vector> > elements;
+ std::vector<shifted_ptr<vector>, shifted_allocator< shifted_ptr<vector> > > elements; //! FIXME
 };
 
 struct create_type {


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