Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r65814 - sandbox/opaque/boost/opaque/meta_mixin
From: vicente.botet_at_[hidden]
Date: 2010-10-07 16:27:49


Author: viboes
Date: 2010-10-07 16:27:40 EDT (Thu, 07 Oct 2010)
New Revision: 65814
URL: http://svn.boost.org/trac/boost/changeset/65814

Log:
Opaque:
* Added more hiding_ meta-mixins

Text files modified:
   sandbox/opaque/boost/opaque/meta_mixin/operators.hpp | 351 +++++++++++++++++++++++++++++++++------
   1 files changed, 293 insertions(+), 58 deletions(-)

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 2010-10-07 16:27:40 EDT (Thu, 07 Oct 2010)
@@ -130,6 +130,14 @@
         };
     };
 
+ template <typename Bool=bool>
+ struct hiding_less_than_equal {
+ template <typename Final, typename Base>
+ struct type: Base {
+ Bool operator<=(const Final& rhs) const;
+ };
+ };
+
 //////////////////////////////////////////////////////////////////////////////
 
 #define BOOST_OPAQUE_USING_GREATER_THAN(Final,Bool) \
@@ -145,6 +153,13 @@
             BOOST_OPAQUE_USING_GREATER_THAN(Final,Bool)
         };
     };
+ template <typename Bool=bool>
+ struct hiding_greater_than {
+ template <typename Final, typename Base>
+ struct type: Base {
+ Bool operator>(const Final& rhs) const;
+ };
+ };
 
 //////////////////////////////////////////////////////////////////////////////
 
@@ -161,6 +176,14 @@
             BOOST_OPAQUE_USING_GREATER_THAN_EQUAL(Final,Bool)
         };
     };
+ template <typename Bool=bool>
+ struct hiding_greater_than_equal {
+ template <typename Final, typename Base>
+ struct type: Base {
+ Bool operator>=(const Final& rhs) const;
+ };
+ };
+
 
 //////////////////////////////////////////////////////////////////////////////
 
@@ -177,6 +200,13 @@
             BOOST_OPAQUE_USING_EQUAL(Final,Bool)
         };
     };
+ template <typename Bool=bool>
+ struct hiding_equal {
+ template <typename Final, typename Base>
+ struct type: Base {
+ Bool operator==(const Final& rhs) const;
+ };
+ };
 
 //////////////////////////////////////////////////////////////////////////////
 
@@ -193,6 +223,13 @@
             BOOST_OPAQUE_USING_NOT_EQUAL(Final,Bool)
         };
     };
+ template <typename Bool=bool>
+ struct hiding_not_equal {
+ template <typename Final, typename Base>
+ struct type: Base {
+ Bool operator!=(const Final& rhs) const;
+ };
+ };
 
 //////////////////////////////////////////////////////////////////////////////
 
@@ -210,6 +247,13 @@
         };
     };
 
+ struct hiding_plus_assign {
+ template <typename Final, typename Base>
+ struct type: Base {
+ Final& operator+=(const Final& rhs);
+ };
+ };
+
 //////////////////////////////////////////////////////////////////////////////
 
 #define BOOST_OPAQUE_USING_MINUS_ASSIGN(Final) \
@@ -225,6 +269,12 @@
             BOOST_OPAQUE_USING_MINUS_ASSIGN(Final)
         };
     };
+ struct hiding_minus_assign {
+ template <typename Final, typename Base>
+ struct type: Base {
+ Final& operator-=(const Final& rhs);
+ };
+ };
 
 //////////////////////////////////////////////////////////////////////////////
 
@@ -241,6 +291,12 @@
             BOOST_OPAQUE_USING_MULTIPLY_ASSIGN(Final)
         };
     };
+ struct hiding_multiply_assign {
+ template <typename Final, typename Base>
+ struct type: Base {
+ Final& operator*=(const Final& rhs);
+ };
+ };
 
 //////////////////////////////////////////////////////////////////////////////
 
@@ -257,6 +313,12 @@
             BOOST_OPAQUE_USING_DIVIDE_ASSIGN(Final)
         };
     };
+ struct hiding_divide_assign {
+ template <typename Final, typename Base>
+ struct type: Base {
+ Final& operator/=(const Final& rhs);
+ };
+ };
 
 //////////////////////////////////////////////////////////////////////////////
 
@@ -273,6 +335,12 @@
             BOOST_OPAQUE_USING_MODULUS_ASSIGN(Final)
         };
     };
+ struct hiding_modulus_assign {
+ template <typename Final, typename Base>
+ struct type: Base {
+ Final& operator%=(const Final& rhs);
+ };
+ };
 
 //////////////////////////////////////////////////////////////////////////////
 
@@ -289,6 +357,12 @@
             BOOST_OPAQUE_USING_BITWISE_XOR_ASSIGN(Final)
         };
     };
+ struct hiding_bitwise_xor_assign {
+ template <typename Final, typename Base>
+ struct type: Base {
+ Final& operator^=(const Final& rhs);
+ };
+ };
 
 //////////////////////////////////////////////////////////////////////////////
 
@@ -305,6 +379,12 @@
             BOOST_OPAQUE_USING_BITWISE_AND_ASSIGN(Final)
         };
     };
+ struct hiding_bitwise_and_assign {
+ template <typename Final, typename Base>
+ struct type: Base {
+ Final& operator&=(const Final& rhs);
+ };
+ };
 
 //////////////////////////////////////////////////////////////////////////////
 
@@ -321,6 +401,12 @@
             BOOST_OPAQUE_USING_BITWISE_OR_ASSIGN(Final)
         };
     };
+ struct hiding_bitwise_or_assign {
+ template <typename Final, typename Base>
+ struct type: Base {
+ Final& operator|=(const Final& rhs);
+ };
+ };
 
 //////////////////////////////////////////////////////////////////////////////
 
@@ -337,6 +423,12 @@
             BOOST_OPAQUE_USING_LEFT_SHIFT_ASSIGN(Final)
         };
     };
+ struct hiding_left_shift_assign {
+ template <typename Final, typename Base>
+ struct type: Base {
+ Final& operator<<=(const Final& rhs);\
+ };
+ };
 
 //////////////////////////////////////////////////////////////////////////////
 
@@ -353,6 +445,12 @@
             BOOST_OPAQUE_USING_RIGHT_SHIFT_ASSIGN(Final)
         };
     };
+ struct hiding_right_shift_assign {
+ template <typename Final, typename Base>
+ struct type: Base {
+ Final& operator>>=(const Final& rhs);
+ };
+ };
 
 // Unary operators
 
@@ -371,6 +469,13 @@
             BOOST_OPAQUE_USING_LOGICAL_NOT(Final,Bool)
         };
     };
+ template <typename Bool=bool>
+ struct hiding_logical_not {
+ template <typename Final, typename Base>
+ struct type: Base {
+ Bool operator!() const;
+ };
+ };
 
 //////////////////////////////////////////////////////////////////////////////
 #define BOOST_OPAQUE_USING_LOGICAL_AND(Final,Bool) \
@@ -386,6 +491,13 @@
             BOOST_OPAQUE_USING_LOGICAL_AND(Final,Bool)
         };
     };
+ template <typename Bool=bool>
+ struct hiding_logical_and {
+ template <typename Final, typename Base>
+ struct type: Base {
+ Bool operator&&(const Final& rhs) const;
+ };
+ };
 
 //////////////////////////////////////////////////////////////////////////////
 #define BOOST_OPAQUE_USING_LOGICAL_OR(Final,Bool) \
@@ -401,6 +513,13 @@
             BOOST_OPAQUE_USING_LOGICAL_OR(Final,Bool)
         };
     };
+ template <typename Bool=bool>
+ struct hiding_logical_or {
+ template <typename Final, typename Base>
+ struct type: Base {
+ Bool operator||(const Final& rhs) const;
+ };
+ };
 
 //////////////////////////////////////////////////////////////////////////////
 
@@ -416,6 +535,12 @@
             BOOST_OPAQUE_USING_UNARY_PLUS(Final)
         };
     };
+ struct hiding_unary_plus {
+ template <typename Final, typename Base>
+ struct type: Base {
+ Final operator+() const;
+ };
+ };
 
 //////////////////////////////////////////////////////////////////////////////
 
@@ -431,6 +556,12 @@
             BOOST_OPAQUE_USING_UNARY_MINUS(Final)
         };
     };
+ struct hiding_unary_minus {
+ template <typename Final, typename Base>
+ struct type: Base {
+ Final operator-() const;
+ };
+ };
 
 //////////////////////////////////////////////////////////////////////////////
 
@@ -446,6 +577,12 @@
             BOOST_OPAQUE_USING_BITWISE_NOT(Final)
         };
     };
+ struct hiding_bitwise_not {
+ template <typename Final, typename Base>
+ struct type: Base {
+ Final operator~() const;
+ };
+ };
 
 //////////////////////////////////////////////////////////////////////////////
 
@@ -542,7 +679,14 @@
             BOOST_OPAQUE_USING_PRE_INCREMENT(Final)
         };
     };
+ struct hiding_pre_increment {
+ template <typename Final, typename Base>
+ struct type: Base {
+ Final& operator++();
+ };
+ };
 
+
 //////////////////////////////////////////////////////////////////////////////
 
 #define BOOST_OPAQUE_USING_PRE_DECREMENT(Final) \
@@ -558,6 +702,12 @@
             BOOST_OPAQUE_USING_PRE_DECREMENT(Final)
         };
     };
+ struct hiding_pre_decrement {
+ template <typename Final, typename Base>
+ struct type: Base {
+ Final& operator--();
+ };
+ };
 
 //////////////////////////////////////////////////////////////////////////////
 
@@ -575,6 +725,12 @@
             BOOST_OPAQUE_USING_POST_INCREMENT(Final)
         };
     };
+ struct hiding_post_increment {
+ template <typename Final, typename Base>
+ struct type: Base {
+ Final operator++(int);
+ };
+ };
 
 //////////////////////////////////////////////////////////////////////////////
 
@@ -592,46 +748,24 @@
             BOOST_OPAQUE_USING_POST_DECREMENT(Final)
         };
     };
-
-#if 0
-// I don't know why this doesn't works :(
-// It works for gcc-3.4
-// It doesn't work for gcc-4.3
+ struct hiding_post_decrement {
+ template <typename Final, typename Base>
+ struct type: Base {
+ Final operator--(int);
+ };
+ };
 
 //////////////////////////////////////////////////////////////////////////////
-
-#define BOOST_OPAQUE_USING_PLUS(Final) \
- public :\
- Final operator+(const Final& rhs) const { \
- return Final(Final::underlying(this) + rhs.underlying()); \
- }
-
-#define BOOST_OPAQUE_USING_MINUS(Final) \
- public :\
- Final operator-(const Final& rhs) const { \
- return Final(Final::underlying(this) - rhs.underlying()); \
- }
-#else
+
 #define BOOST_OPAQUE_USING_PLUS(Final) \
- public :\
+ private : \
             Final using_plus_op(const Final& rhs) const { \
                 return Final(Final::underlying(this) + rhs.underlying()); \
             } \
         friend Final operator+(const Final& lhs, const Final& rhs) { \
             return lhs.using_plus_op(rhs); \
         }
-
- //return Final(lhs.underlying() + rhs.underlying());
     
-#define BOOST_OPAQUE_USING_MINUS(Final) \
- public :\
- friend Final operator-(const Final& lhs, const Final& rhs) { \
- return Final(lhs.underlying() - rhs.underlying()); \
- }
-#endif
-
-//////////////////////////////////////////////////////////////////////////////
-
     struct using_plus {
         template <typename Final, typename Base>
         struct type: Base {
@@ -639,19 +773,26 @@
         };
     };
 
-//////////////////////////////////////////////////////////////////////////////
     struct hiding_plus {
         template <typename Final, typename Base>
         struct type: Base {
         private :
- //friend Final operator+(const Final& lhs, const Final& rhs);
                 Final using_plus_op(const Final& rhs) const;
- //Final operator+(const Final& rhs) const;
         };
     };
-
+
 //////////////////////////////////////////////////////////////////////////////
+
+#define BOOST_OPAQUE_USING_MINUS(Final) \
+ private : \
+ Final using_minus_op(const Final& rhs) const { \
+ return Final(Final::underlying(this) - rhs.underlying()); \
+ } \
+ friend Final operator-(const Final& lhs, const Final& rhs) { \
+ return lhs.using_minus_op(rhs); \
+ }
 
+
     struct using_minus {
         template <typename Final, typename Base>
         struct type: Base {
@@ -659,12 +800,23 @@
         };
     };
 
+ struct hiding_minus {
+ template <typename Final, typename Base>
+ struct type: Base {
+ private :
+ Final using_minus_op(const Final& rhs) const;
+ };
+ };
+
 //////////////////////////////////////////////////////////////////////////////
 
 #define BOOST_OPAQUE_USING_MULTIPLY(Final) \
- public :\
- Final operator*(const Final& rhs) const { \
- return Final(Final::underlying(this) * rhs.underlying()); \
+ private : \
+ Final using_multiply_op(const Final& rhs) const { \
+ return Final(Final::underlying(this) * rhs.underlying()); \
+ } \
+ friend Final operator*(const Final& lhs, const Final& rhs) { \
+ return lhs.using_multiply_op(rhs); \
         }
 
     struct using_multiply {
@@ -674,12 +826,23 @@
         };
     };
 
+ struct hiding_multiply {
+ template <typename Final, typename Base>
+ struct type: Base {
+ private :
+ Final using_multiply_op(const Final& rhs) const;
+ };
+ };
+
 //////////////////////////////////////////////////////////////////////////////
 
 #define BOOST_OPAQUE_USING_DIVIDE(Final) \
- public :\
- Final operator/(const Final& rhs) const { \
- return Final(Final::underlying(this) / rhs.underlying()); \
+ private : \
+ Final using_divide_op(const Final& rhs) const { \
+ return Final(Final::underlying(this) / rhs.underlying()); \
+ } \
+ friend Final operator/(const Final& lhs, const Final& rhs) { \
+ return lhs.using_divide_op(rhs); \
         }
 
     struct using_divide {
@@ -689,13 +852,23 @@
         };
     };
 
+ struct hiding_divide {
+ template <typename Final, typename Base>
+ struct type: Base {
+ private :
+ Final using_divide_op(const Final& rhs) const;
+ };
+ };
 
 //////////////////////////////////////////////////////////////////////////////
 
 #define BOOST_OPAQUE_USING_MODULUS(Final) \
- public :\
- Final operator%(const Final& rhs) const { \
- return Final(Final::underlying(this) % rhs.underlying()); \
+ private : \
+ Final using_modulus_op(const Final& rhs) const { \
+ return Final(Final::underlying(this) % rhs.underlying()); \
+ } \
+ friend Final operator%(const Final& lhs, const Final& rhs) { \
+ return lhs.using_modulus_op(rhs); \
         }
 
     struct using_modulus {
@@ -705,12 +878,23 @@
         };
     };
 
+ struct hiding_modulus {
+ template <typename Final, typename Base>
+ struct type: Base {
+ private :
+ Final using_modulus_op(const Final& rhs) const;
+ };
+ };
+
 //////////////////////////////////////////////////////////////////////////////
 
 #define BOOST_OPAQUE_USING_BITWISE_XOR(Final) \
- public :\
- Final operator^(const Final& rhs) const { \
- return Final(Final::underlying(this) ^ rhs.underlying()); \
+ private : \
+ Final using_bitwise_xor_op(const Final& rhs) const { \
+ return Final(Final::underlying(this) ^ rhs.underlying()); \
+ } \
+ friend Final operator^(const Final& lhs, const Final& rhs) { \
+ return lhs.using_bitwise_xor_op(rhs); \
         }
 
     struct using_bitwise_xor {
@@ -720,13 +904,23 @@
         };
     };
 
+ struct hiding_bitwise_xor {
+ template <typename Final, typename Base>
+ struct type: Base {
+ private :
+ Final using_bitwise_xor_op(const Final& rhs) const;
+ };
+ };
 
 //////////////////////////////////////////////////////////////////////////////
 
 #define BOOST_OPAQUE_USING_BITWISE_OR(Final) \
- public :\
- Final operator|(const Final& rhs) const { \
- return Final(Final::underlying(this) | rhs.underlying()); \
+ private : \
+ Final using_bitwise_or_op(const Final& rhs) const { \
+ return Final(Final::underlying(this) | rhs.underlying()); \
+ } \
+ friend Final operator|(const Final& lhs, const Final& rhs) { \
+ return lhs.using_bitwise_or_op(rhs); \
         }
 
     struct using_bitwise_or {
@@ -736,12 +930,23 @@
         };
     };
 
+ struct hiding_bitwise_or {
+ template <typename Final, typename Base>
+ struct type: Base {
+ private :
+ Final using_bitwise_or_op(const Final& rhs) const;
+ };
+ };
+
 //////////////////////////////////////////////////////////////////////////////
 
 #define BOOST_OPAQUE_USING_BITWISE_AND(Final) \
- public :\
- Final operator&(const Final& rhs) const { \
- return Final(Final::underlying(this) & rhs.underlying()); \
+ private : \
+ Final using_bitwise_and_op(const Final& rhs) const { \
+ return Final(Final::underlying(this) & rhs.underlying()); \
+ } \
+ friend Final operator&(const Final& lhs, const Final& rhs) { \
+ return lhs.using_bitwise_and_op(rhs); \
         }
 
     struct using_bitwise_and {
@@ -751,12 +956,23 @@
         };
     };
 
+ struct hiding_bitwise_and {
+ template <typename Final, typename Base>
+ struct type: Base {
+ private :
+ Final using_bitwise_and_op(const Final& rhs) const;
+ };
+ };
+
 //////////////////////////////////////////////////////////////////////////////
 
 #define BOOST_OPAQUE_USING_LEFT_SHIFT1(Final) \
- public :\
- Final operator<<(const Final& rhs) const { \
- return Final(Final::underlying(this) << rhs.underlying()); \
+ private : \
+ Final using_left_shift_op(const Final& rhs) const { \
+ return Final(Final::underlying(this) << rhs.underlying()); \
+ } \
+ friend Final operator<<(const Final& lhs, const Final& rhs) { \
+ return lhs.using_left_shift_op(rhs); \
         }
 
     struct using_left_shift1 {
@@ -766,12 +982,23 @@
         };
     };
 
+ struct hiding_left_shift {
+ template <typename Final, typename Base>
+ struct type: Base {
+ private :
+ Final using_left_shift_op(const Final& rhs) const;
+ };
+ };
+
 //////////////////////////////////////////////////////////////////////////////
 
 #define BOOST_OPAQUE_USING_RIGHT_SHIFT1(Final) \
- public :\
- Final operator>>(const Final& rhs) const { \
- return Final(Final::underlying(this) >> rhs.underlying()); \
+ private : \
+ Final using_right_shift_op(const Final& rhs) const { \
+ return Final(Final::underlying(this) >> rhs.underlying()); \
+ } \
+ friend Final operator>>(const Final& lhs, const Final& rhs) { \
+ return lhs.using_right_shift_op(rhs); \
         }
 
     struct using_right_shift1 {
@@ -781,6 +1008,14 @@
         };
     };
 
+ struct hiding_right_shift {
+ template <typename Final, typename Base>
+ struct type: Base {
+ private :
+ Final using_right_shift_op(const Final& rhs) const;
+ };
+ };
+
 }
 }
 


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