Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r51347 - in sandbox/mirror: boost/mirror boost/mirror/detail libs/mirror/example/special
From: chochlik_at_[hidden]
Date: 2009-02-20 05:35:47


Author: matus.chochlik
Date: 2009-02-20 05:35:46 EST (Fri, 20 Feb 2009)
New Revision: 51347
URL: http://svn.boost.org/trac/boost/changeset/51347

Log:
[mirror 0.3.x]
- minor updates
Text files modified:
   sandbox/mirror/boost/mirror/detail/meta_attribs_base.hpp | 15 +++++++++++++++
   sandbox/mirror/boost/mirror/meta_attributes.hpp | 6 ++++++
   sandbox/mirror/libs/mirror/example/special/boost_tuple.cpp | 4 ++--
   3 files changed, 23 insertions(+), 2 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-20 05:35:46 EST (Fri, 20 Feb 2009)
@@ -312,6 +312,9 @@
                 Class& instance, \
                 position_of_##NAME position \
         ){return NULL;} \
+ static inline type_of_##NAME* address_zero_based( \
+ position_of_##NAME position \
+ ){return NULL;} \
         BOOST_MIRROR_REG_TEMPLATE_OR_CLASS_ATTRIB_EPILOGUE( \
                 TYPE_SELECTOR, \
                 NAME, \
@@ -381,6 +384,9 @@
                 Class& instance, \
                 position_of_##NAME position \
         ){return &instance.NAME;} \
+ static inline type_of_##NAME* address_zero_based( \
+ position_of_##NAME position \
+ ){return &(((Class*)0)->NAME);} \
         BOOST_MIRROR_REG_TEMPLATE_OR_CLASS_ATTRIB_EPILOGUE( \
                 TYPE_SELECTOR, \
                 NAME, \
@@ -568,6 +574,15 @@
                         (const unsigned char*)base_class::address(instance, pos)
                 );
         }
+
+ template <int I>
+ static inline ptrdiff_t offset_zero_based(mpl::int_<I> pos)
+ {
+ return calculate_offset(
+ (const unsigned char*)0,
+ (const unsigned char*)base_class::address_zero_based(pos)
+ );
+ }
 };
 
                 

Modified: sandbox/mirror/boost/mirror/meta_attributes.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/meta_attributes.hpp (original)
+++ sandbox/mirror/boost/mirror/meta_attributes.hpp 2009-02-20 05:35:46 EST (Fri, 20 Feb 2009)
@@ -850,6 +850,12 @@
                         return meta_attributes::offset(instance, position());
                 }
 
+ // offset getter
+ inline static ptrdiff_t offset_zero_based(void)
+ {
+ return meta_attributes::offset_zero_based(position());
+ }
+
                 // value getter
                 inline static typename result_of_get::type get(
                         const owner_class& instance

Modified: sandbox/mirror/libs/mirror/example/special/boost_tuple.cpp
==============================================================================
--- sandbox/mirror/libs/mirror/example/special/boost_tuple.cpp (original)
+++ sandbox/mirror/libs/mirror/example/special/boost_tuple.cpp 2009-02-20 05:35:46 EST (Fri, 20 Feb 2009)
@@ -48,8 +48,8 @@
                                                 cts::bcout() <<
                                 " " <<
                                 ma.base_name() <<
- " [offset: " <<
- ma.offset(inst) <<
+ " [offset: " <<
+ ma.offset(inst) <<
                                 "] = " <<
                                 ma.get(inst) <<
                                 endl;


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