Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r65585 - sandbox/opaque/boost/opaque
From: vicente.botet_at_[hidden]
Date: 2010-09-25 04:55:15


Author: viboes
Date: 2010-09-25 04:55:02 EDT (Sat, 25 Sep 2010)
New Revision: 65585
URL: http://svn.boost.org/trac/boost/changeset/65585

Log:
Opaque: Ass shiftable
Text files modified:
   sandbox/opaque/boost/opaque/combined_operators.hpp | 18 ++++----
   sandbox/opaque/boost/opaque/opaque_type.hpp | 27 ++----------
   sandbox/opaque/boost/opaque/operators.hpp | 82 +++++++++++++++++++--------------------
   3 files changed, 54 insertions(+), 73 deletions(-)

Modified: sandbox/opaque/boost/opaque/combined_operators.hpp
==============================================================================
--- sandbox/opaque/boost/opaque/combined_operators.hpp (original)
+++ sandbox/opaque/boost/opaque/combined_operators.hpp 2010-09-25 04:55:02 EDT (Sat, 25 Sep 2010)
@@ -57,11 +57,11 @@
     template <typename Final, typename Base=base_new_type>
     struct decrementable : boost::decrementable<Final, ope::pre_decrement<Final, Base> > {};
 
- //~ template <typename Final, typename Base=base_new_type>
- //~ struct left_shiftable : boost::left_shiftable<Final, ope::left_shift<Final, Base> > {};
+ template <typename Final, typename Base=base_new_type>
+ struct left_shiftable1 : boost::left_shiftable1<Final, ope::left_shift_assign<Final, Base> > {};
 
- //~ template <typename Final, typename Base=base_new_type>
- //~ struct right_shiftable : boost::right_shiftable<Final, ope::right_shift<Final, Base> > {};
+ template <typename Final, typename Base=base_new_type>
+ struct right_shiftable1 : boost::right_shiftable1<Final, ope::right_shift_assign<Final, Base> > {};
 
     template <typename Final, typename Base=base_new_type>
     struct partially_ordered1 : boost::less_than_comparable1<Final, ope::less_than<Final, Base> > {};
@@ -159,11 +159,11 @@
         //~ , opaque::right_shiftable2<T, U, B
           //~ > > {};
 
- //~ template <class T, class B = base_new_type >
- //~ struct shiftable1
- //~ : opaque::left_shiftable1<T
- //~ , opaque::right_shiftable1<T, B
- //~ > > {};
+ template <class T, class B = base_new_type >
+ struct shiftable1
+ : opaque::left_shiftable1<T
+ , opaque::right_shiftable1<T, B
+ > > {};
 
     //~ template <class T, class U, class B = base_new_type >
     //~ struct ring_operators2

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 04:55:02 EDT (Sat, 25 Sep 2010)
@@ -21,31 +21,16 @@
     template <typename T, typename Final, typename Base>
     struct inherited_from_undelying {
         struct type :
- boost::totally_ordered< Final
- , boost::integer_arithmetic< Final
- , boost::bitwise< Final
- , boost::unit_steppable< Final
- , opaque::ope::less_than<Final
- , opaque::ope::equal<Final
- , opaque::ope::plus_assign<Final
- , opaque::ope::minus_assign<Final
- , opaque::ope::multiply_assign<Final
- , opaque::ope::divide_assign<Final
- , opaque::ope::modulus_assign<Final
- , underlying_access< Final, T, Base >
- >
- >
- >
+ opaque::totally_ordered1< Final
+ , opaque::integer_arithmetic1< Final
+ , boost::bitwise1< Final
+ , opaque::unit_steppable< Final
+ , underlying_access< Final, T, Base >
>
- >
- >
- >
+ >
>
- >
>
- >
         {};
-
     };
     
     template <typename Final, typename T, typename Base>

Modified: sandbox/opaque/boost/opaque/operators.hpp
==============================================================================
--- sandbox/opaque/boost/opaque/operators.hpp (original)
+++ sandbox/opaque/boost/opaque/operators.hpp 2010-09-25 04:55:02 EDT (Sat, 25 Sep 2010)
@@ -123,6 +123,20 @@
             return x;
         }
     };
+ template <typename Final, typename Base=base_new_type>
+ struct left_shift_assign : Base {
+ friend Final& operator<<=(Final& x, const Final& y) {
+ x.underlying() <<= y.underlying();
+ return x;
+ }
+ };
+ template <typename Final, typename Base=base_new_type>
+ struct right_shift_assign : Base {
+ friend Final& operator>>=(Final& x, const Final& y) {
+ x.underlying() >>= y.underlying();
+ return x;
+ }
+ };
     // Unary operators
 
     template <typename Final, typename Base=base_new_type>
@@ -154,18 +168,31 @@
     
     //~ template <typename Final, typename Base=base_new_type>
     //~ struct address_of : Base {
- //~ friend Final const& operator&(Final const& x) {
- //~ return &x;
+ //~ Final* operator&() {
+ //~ return this;
         //~ }
     //~ };
     
- template <typename Final, typename Base=base_new_type>
- struct derreference : Base {
- friend Final& operator*(Final const& x) {
- return Final(~(x.underlying()));
- }
- };
+ //~ 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>
@@ -178,8 +205,8 @@
     
     template <typename Final, typename Base=base_new_type>
     struct pre_decrement : Base {
- friend Final& operator++(Final& x) {
- ++x.underlying();
+ friend Final& operator--(Final& x) {
+ --x.underlying();
             return x;
         }
     };
@@ -188,7 +215,7 @@
     struct post_increment : Base {
         friend Final operator++(Final& x, int) {
             typename Final::underlying_type nrv(x);
- ++x;
+ x++;
             return nrv;
         }
     };
@@ -197,43 +224,12 @@
     struct post_decrement : Base {
         friend Final operator--(Final& x, int) {
             typename Final::underlying_type nrv(x);
- --x;
+ x--;
             return nrv;
         }
     };
     
 }
-#if 0
- template <typename Final, typename Base=base_new_type>
- struct equality_comparable1 : boost::equality_comparable1<Final, ope::equal<Final, Base> > {};
-
- template <typename Final, typename Base=base_new_type>
- struct less_than_comparable1 : boost::less_than_comparable1<Final, ope::less_than<Final, Base> > {};
-
- template <typename Final, typename Base=base_new_type>
- struct addable1 : boost::addable1<Final, ope::plus_assign<Final, Base> > {};
-
- template <typename Final, typename Base=base_new_type>
- struct subtractable1 : boost::subtractable1<Final, ope::minus_assign<Final, Base> > {};
-
- template <typename Final, typename Base=base_new_type>
- struct multipliable1 : boost::multipliable1<Final, ope::multiply_assign<Final, Base> > {};
-
- template <typename Final, typename Base=base_new_type>
- struct dividable1 : boost::dividable1<Final, ope::divide_assign<Final, Base> > {};
-
- template <typename Final, typename Base=base_new_type>
- struct modable1 : boost::modable1<Final, ope::modulus_assign<Final, Base> > {};
-
- template <typename Final, typename Base=base_new_type>
- struct xorable1 : boost::xorable1<Final, ope::bitwise_xor_assign<Final, Base> > {};
-
- template <typename Final, typename Base=base_new_type>
- struct andable1 : boost::andable1<Final, ope::bitwise_and_assign<Final, Base> > {};
-
- template <typename Final, typename Base=base_new_type>
- struct orable1 : boost::orable1<Final, ope::bitwise_or_assign<Final, Base> > {};
-#endif
 
 }
 }


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