Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r70673 - sandbox/opaque/boost/opaque/meta_mixin
From: vicente.botet_at_[hidden]
Date: 2011-03-28 17:28:28


Author: viboes
Date: 2011-03-28 17:28:27 EDT (Mon, 28 Mar 2011)
New Revision: 70673
URL: http://svn.boost.org/trac/boost/changeset/70673

Log:
Opaque: Fix issues while hiding friends
Text files modified:
   sandbox/opaque/boost/opaque/meta_mixin/combined_operators.hpp | 2 ++
   sandbox/opaque/boost/opaque/meta_mixin/operators.hpp | 32 +++++++++++++++++++++++---------
   2 files changed, 25 insertions(+), 9 deletions(-)

Modified: sandbox/opaque/boost/opaque/meta_mixin/combined_operators.hpp
==============================================================================
--- sandbox/opaque/boost/opaque/meta_mixin/combined_operators.hpp (original)
+++ sandbox/opaque/boost/opaque/meta_mixin/combined_operators.hpp 2011-03-28 17:28:27 EDT (Mon, 28 Mar 2011)
@@ -19,6 +19,8 @@
  * The composite operator templates only list what other templates they use.
  * The supplied operations and requirements of the composite operator templates can be inferred from the
  * operations and requirements of the listed components.
+ *
+ * See the section for a complete list of combined meta-mixins.
  */
 
 #ifndef BOOST_OPAQUE_COMBINED_OPERATORS_HPP

Modified: sandbox/opaque/boost/opaque/meta_mixin/operators.hpp
==============================================================================
--- sandbox/opaque/boost/opaque/meta_mixin/operators.hpp (original)
+++ sandbox/opaque/boost/opaque/meta_mixin/operators.hpp 2011-03-28 17:28:27 EDT (Mon, 28 Mar 2011)
@@ -70,6 +70,10 @@
 namespace boost {
   namespace opaque {
 
+
+#define BOOST_OPAQUE_INTERNAL_NAME(NAME) \
+ BOOST_JOIN(BOOST_JOIN(boost_opaque_internal_,NAME),_op)
+
 //////////////////////////////////////////////////////////////////////////////
 
     #define BOOST_OPAQUE_HIDING_COPY_CONSTRUCTOR(T) \
@@ -195,14 +199,24 @@
       template <typename Final, typename Base> \
       struct type: Base \
       { \
- friend Bool operator OP (const Final& lhs, const U& rhs) \
+ private:\
+ static Bool BOOST_OPAQUE_INTERNAL_NAME(NAME) (const Final& lhs, const U& rhs) \
         { \
           return Bool(lhs.underlying() OP rhs);\
         } \
- friend Bool operator OP (const U& lhs, const Final& rhs) \
+ static Bool BOOST_OPAQUE_INTERNAL_NAME(NAME) (const U& lhs, const Final& rhs) \
         { \
           return Bool(lhs OP rhs.underlying());\
         } \
+ public:\
+ friend Bool operator OP (const Final& lhs, const U& rhs) \
+ { \
+ return Final::BOOST_OPAQUE_INTERNAL_NAME(NAME)(lhs, rhs);\
+ } \
+ friend Bool operator OP (const U& lhs, const Final& rhs) \
+ { \
+ return Final::BOOST_OPAQUE_INTERNAL_NAME(NAME)(lhs, rhs);\
+ } \
       }; \
     }; \
     template <typename U, typename Bool=bool> \
@@ -212,8 +226,8 @@
         struct type: Base \
         { \
         private :\
- friend Bool operator OP (const Final& lhs, const U& rhs); \
- friend Bool operator OP (const U& lhs, const Final& rhs); \
+ static Bool BOOST_JOIN(BOOST_JOIN(using_,NAME),_op) (const Final& lhs, const U& rhs); \
+ static Bool BOOST_JOIN(BOOST_JOIN(using_,NAME),_op) (const U& lhs, const Final& rhs); \
         }; \
     }; \
 
@@ -868,11 +882,11 @@
     
 #define BOOST_OPAQUE_USING_PLUS(Final) \
     private : \
- Final using_plus_op(const Final& rhs) const { \
- return Final(Final::underlying(this) + rhs.underlying()); \
+ static Final using_plus_op(const Final& lhs, const Final& rhs) { \
+ return Final(lhs.underlying() + rhs.underlying()); \
         } \
         friend Final operator+(const Final& lhs, const Final& rhs) { \
- return lhs.using_plus_op(rhs); \
+ return Final::using_plus_op(lhs, rhs); \
         }
     
     struct using_plus {
@@ -886,7 +900,7 @@
         template <typename Final, typename Base>
         struct type: Base {
         private :
- Final using_plus_op(const Final& rhs) const;
+ static Final using_plus_op(const Final& lhs, const Final& rhs);
         };
     };
    
@@ -897,7 +911,7 @@
         Final using_minus_op(const Final& rhs) const { \
             return Final(Final::underlying(this) - rhs.underlying()); \
         } \
- friend Final operator-(const Final& lhs, const Final& rhs) { \
+ friend Final operator-(const Final& lhs, const Final& rhs) { \
             return lhs.using_minus_op(rhs); \
         }
 


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