Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r51454 - sandbox/mirror/boost/mirror/detail
From: chochlik_at_[hidden]
Date: 2009-02-26 11:43:09


Author: matus.chochlik
Date: 2009-02-26 11:43:08 EST (Thu, 26 Feb 2009)
New Revision: 51454
URL: http://svn.boost.org/trac/boost/changeset/51454

Log:
[mirror 0.3.x]
- update of offset_of

Text files modified:
   sandbox/mirror/boost/mirror/detail/meta_attribs_base.hpp | 26 +++++++-------------------
   1 files changed, 7 insertions(+), 19 deletions(-)

Modified: sandbox/mirror/boost/mirror/detail/meta_attribs_base.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/detail/meta_attribs_base.hpp (original)
+++ sandbox/mirror/boost/mirror/detail/meta_attribs_base.hpp 2009-02-26 11:43:08 EST (Thu, 26 Feb 2009)
@@ -556,32 +556,20 @@
         typedef unsigned char byte;
         typedef const byte* byte_ptr;
 
- template <class T>
         struct dummy_instance
         {
- inline T* ptr(void) const
+ inline Class* ptr(void) const
                 {
- return reinterpret_cast<T*>(
- ::boost::alignment_of<T>::value
+ return reinterpret_cast<Class*>(
+ ::boost::alignment_of<Class>::value
                         );
                 }
 
- inline operator T& (void) const
+ inline Class& ref(void) const
                 {
- T* pointer(ptr());
+ Class* pointer(ptr());
                         return *pointer;
                 }
-
- inline operator const T& (void) const
- {
- const T* pointer(ptr());
- return *pointer;
- }
-
- inline T* operator & (void) const
- {
- return ptr();
- }
         };
 
         static inline ptrdiff_t invalid_offset(void)
@@ -627,7 +615,7 @@
                 // this can be a problem with pod-types
                 // meta-types of which have custom implementation
                 // of address(...) expecting a valid instance
- dummy_instance<T> instance;
+ dummy_instance instance;
                 //
                 // otherwise something like the following will
                 // be necessary:
@@ -636,7 +624,7 @@
                 //T* pointer((T*)alloc.allocate(1));
                 // ...
                 // alloc.deallocate(pointer, 1);
- return offset(instance, pos);
+ return offset(instance.ref(), pos);
         }
 
         template <class T, int I>


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