Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r65588 - sandbox/opaque/boost/opaque
From: vicente.botet_at_[hidden]
Date: 2010-09-25 10:44:28


Author: viboes
Date: 2010-09-25 10:44:27 EDT (Sat, 25 Sep 2010)
New Revision: 65588
URL: http://svn.boost.org/trac/boost/changeset/65588

Log:
Opaque: Fix unary minus + change opaque interface
Text files modified:
   sandbox/opaque/boost/opaque/opaque_type.hpp | 7 ++++++-
   sandbox/opaque/boost/opaque/operators.hpp | 34 +++++++++++++++++-----------------
   sandbox/opaque/boost/opaque/private_opaque_type.hpp | 18 ++++++++++++++----
   sandbox/opaque/boost/opaque/public_opaque_type.hpp | 27 +++++++++++++++++++--------
   4 files changed, 56 insertions(+), 30 deletions(-)

Modified: sandbox/opaque/boost/opaque/opaque_type.hpp
==============================================================================
--- sandbox/opaque/boost/opaque/opaque_type.hpp (original)
+++ sandbox/opaque/boost/opaque/opaque_type.hpp 2010-09-25 10:44:27 EDT (Sat, 25 Sep 2010)
@@ -25,7 +25,12 @@
             , opaque::integer_arithmetic1< Final
                 , boost::bitwise1< Final
                     , opaque::unit_steppable< Final
- , underlying_access< Final, T, Base >
+ , opaque::ope::unary_plus< Final
+ , opaque::ope::unary_minus< Final
+ , Base
+ //~ , underlying_access< Final, T, Base >
+ >
+ >
>
>
>

Modified: sandbox/opaque/boost/opaque/operators.hpp
==============================================================================
--- sandbox/opaque/boost/opaque/operators.hpp (original)
+++ sandbox/opaque/boost/opaque/operators.hpp 2010-09-25 10:44:27 EDT (Sat, 25 Sep 2010)
@@ -19,7 +19,7 @@
 namespace boost {
 
 namespace opaque {
-namespace ope {
+namespace ope {
     template <typename Base=base_new_type>
     struct copy_delete : Base {
     private: // emphasize the following members are private
@@ -75,7 +75,7 @@
             return x;
         }
     };
-
+
     template <typename Final, typename Base=base_new_type>
     struct multiply_assign : Base {
         friend Final& operator*=(Final& x, const Final& y) {
@@ -99,7 +99,7 @@
             return x;
         }
     };
-
+
     template <typename Final, typename Base=base_new_type>
     struct bitwise_xor_assign : Base {
         friend Final& operator^=(Final& x, const Final& y) {
@@ -107,7 +107,7 @@
             return x;
         }
     };
-
+
     template <typename Final, typename Base=base_new_type>
     struct bitwise_and_assign : Base {
         friend Final& operator&=(Final& x, const Final& y) {
@@ -115,7 +115,7 @@
             return x;
         }
     };
-
+
     template <typename Final, typename Base=base_new_type>
     struct bitwise_or_assign : Base {
         friend Final& operator|=(Final& x, const Final& y) {
@@ -148,52 +148,52 @@
 
     template <typename Final, typename Base=base_new_type>
     struct unary_plus : Base {
- friend Final& operator+(Final const& x) {
+ friend Final operator+(Final const& x) {
             return x;
         }
     };
     template <typename Final, typename Base=base_new_type>
     struct unary_minus : Base {
- friend Final operator+(Final const& x) {
+ friend Final operator-(Final const& x) {
             return Final(-(x.underlying()));
         }
     };
-
+
     template <typename Final, typename Base=base_new_type>
     struct bitwise_not : Base {
         friend Final operator~(Final const& x) {
             return Final(~(x.underlying()));
         }
     };
-
+
     //~ template <typename Final, typename Base=base_new_type>
     //~ struct address_of : Base {
         //~ Final* operator&() {
             //~ return this;
         //~ }
     //~ };
-
+
     //~ template <typename Final, typename Derreference=typename reference<Final::underlying_type>::type, typename Base=base_new_type>
     //~ struct derreference : Base {
         //~ Derreference operator*() {
             //~ return *(x.underlying());
         //~ }
     //~ };
-
+
     //~ template <typename Final, typename Pointer=typename pointer<Final::underlying_type>::type, typename Base=base_new_type>
     //~ struct member_access : Base {
         //~ Pointer operator->() {
             //~ return x.underlying().operator->();
         //~ }
     //~ };
-
+
     //~ template <typename Final, class I, class R, typename Base=base_new_type>
     //~ struct subscript : Base {
         //~ R operator[](I n) {
             //~ return x.underlying()[i];
         //~ }
     //~ };
-
+
     // Increment and decrement
     template <typename Final, typename Base=base_new_type>
     struct pre_increment : Base {
@@ -202,7 +202,7 @@
             return x;
         }
     };
-
+
     template <typename Final, typename Base=base_new_type>
     struct pre_decrement : Base {
         friend Final& operator--(Final& x) {
@@ -210,7 +210,7 @@
             return x;
         }
     };
-
+
     template <typename Final, typename Base=base_new_type>
     struct post_increment : Base {
         friend Final operator++(Final& x, int) {
@@ -219,7 +219,7 @@
             return nrv;
         }
     };
-
+
     template <typename Final, typename Base=base_new_type>
     struct post_decrement : Base {
         friend Final operator--(Final& x, int) {
@@ -228,7 +228,7 @@
             return nrv;
         }
     };
-
+
 }
 
 }

Modified: sandbox/opaque/boost/opaque/private_opaque_type.hpp
==============================================================================
--- sandbox/opaque/boost/opaque/private_opaque_type.hpp (original)
+++ sandbox/opaque/boost/opaque/private_opaque_type.hpp 2010-09-25 10:44:27 EDT (Sat, 25 Sep 2010)
@@ -22,11 +22,21 @@
 
     class base_private_opaque_type {};
 
- template <typename Final, typename T, typename Base=base_private_opaque_type>
- class private_opaque_type
- : public new_type< Final, T, typename inherited_from_undelying<T, Final, Base>::type >
+ template <typename Final, typename T>
+ class private_opaque_type : public
+ new_type< Final, T,
+ typename inherited_from_undelying<T, Final,
+ underlying_access< Final, T, base_private_opaque_type >
+ >::type
+ >
     {
- typedef new_type< Final, T, typename inherited_from_undelying<T, Final, Base>::type > base_type;
+ typedef
+ new_type< Final, T,
+ typename inherited_from_undelying<T, Final,
+ underlying_access< Final, T, base_private_opaque_type >
+ >::type
+ >
+ base_type;
     protected:
         typedef private_opaque_type opaque_type_t;
     public:

Modified: sandbox/opaque/boost/opaque/public_opaque_type.hpp
==============================================================================
--- sandbox/opaque/boost/opaque/public_opaque_type.hpp (original)
+++ sandbox/opaque/boost/opaque/public_opaque_type.hpp 2010-09-25 10:44:27 EDT (Sat, 25 Sep 2010)
@@ -14,7 +14,6 @@
 #define BOOST_OPAQUE_PUBLIC_OPAQUE_TYPE_HPP
 
 #include <boost/opaque/opaque_type.hpp>
-//~ #include <boost/opaque/transitive_substituable.hpp>
 
 #include <boost/type_traits/is_class.hpp>
 #include <boost/type_traits/is_base_of.hpp>
@@ -66,15 +65,27 @@
         }
     };
 
- template <typename Final, typename T, typename Base=base_public_opaque_type>
+ template <typename Final, typename T>
     class public_opaque_type
         : public
- new_type< Final, T, transitive_substituable<T, typename inherited_from_undelying<T, Final, Base>::type > >
+ new_type< Final, T,
+ transitive_substituable<T,
+ typename inherited_from_undelying<T, Final,
+ underlying_access< Final, T, base_public_opaque_type >
+ >::type
+ >
+ >
 
     {
         typedef
- new_type< Final, T, transitive_substituable<T, typename inherited_from_undelying<T, Final, Base>::type > >
- base_type;
+ new_type< Final, T,
+ transitive_substituable<T,
+ typename inherited_from_undelying<T, Final,
+ underlying_access< Final, T, base_public_opaque_type >
+ >::type
+ >
+ >
+ base_type;
 
     protected:
         typedef public_opaque_type opaque_type_t;
@@ -95,9 +106,9 @@
         template <typename W>
         explicit public_opaque_type(W v) : base_type(v) {}
 
- public_opaque_type & operator=(const opaque_type_t & rhs) {
- this->val_ = rhs.val_; return *this;
- }
+ //~ public_opaque_type & operator=(const opaque_type_t & rhs) {
+ //~ this->val_ = rhs.val_; return *this;
+ //~ }
 
     };
 


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