Boost logo

Boost-Commit :

From: eric_at_[hidden]
Date: 2008-05-12 21:17:35


Author: eric_niebler
Date: 2008-05-12 21:17:35 EDT (Mon, 12 May 2008)
New Revision: 45313
URL: http://svn.boost.org/trac/boost/changeset/45313

Log:
extends<> gets the addressof hack
Text files modified:
   branches/proto/v4/boost/proto/expr.hpp | 13 ++++++++++++-
   branches/proto/v4/boost/proto/extends.hpp | 6 ++++++
   2 files changed, 18 insertions(+), 1 deletions(-)

Modified: branches/proto/v4/boost/proto/expr.hpp
==============================================================================
--- branches/proto/v4/boost/proto/expr.hpp (original)
+++ branches/proto/v4/boost/proto/expr.hpp 2008-05-12 21:17:35 EDT (Mon, 12 May 2008)
@@ -55,10 +55,17 @@
             typedef void BOOST_PP_CAT(proto_child_ref, N); \
             /**/
 
+ struct not_a_valid_type
+ {
+ private:
+ not_a_valid_type()
+ {}
+ };
+
             template<typename Tag, typename Arg>
             struct address_of_hack
             {
- typedef address_of_hack type;
+ typedef not_a_valid_type type;
             };
 
             template<typename Expr>
@@ -255,6 +262,10 @@
             {
                 return boost::addressof(this->child0);
             }
+ #else
+ /// INTERNAL ONLY
+ ///
+ typedef detail::not_a_valid_type address_of_hack_type_;
         #endif
 
             /// Assignment

Modified: branches/proto/v4/boost/proto/extends.hpp
==============================================================================
--- branches/proto/v4/boost/proto/extends.hpp (original)
+++ branches/proto/v4/boost/proto/extends.hpp 2008-05-12 21:17:35 EDT (Mon, 12 May 2008)
@@ -113,6 +113,7 @@
         typedef typename proto_base_expr::proto_tag proto_tag; \
         typedef typename proto_base_expr::proto_args proto_args; \
         typedef typename proto_base_expr::proto_arity proto_arity; \
+ typedef typename proto_base_expr::address_of_hack_type_ proto_address_of_hack_type_; \
         typedef void proto_is_expr_; \
         BOOST_PROTO_FUSION_DEFINE_TAG(boost::proto::tag::proto_expr) \
         BOOST_PP_REPEAT(BOOST_PROTO_MAX_ARITY, BOOST_PROTO_EXTENDS_CHILD, ~) \
@@ -132,6 +133,11 @@
         { \
             return this->proto_expr_.proto_base(); \
         } \
+ \
+ operator proto_address_of_hack_type_() const \
+ { \
+ return boost::addressof(this->proto_base().child0); \
+ } \
         /**/
 
     #define BOOST_PROTO_BASIC_EXTENDS(Expr, Derived, Domain) \


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