Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r65583 - sandbox/opaque/boost/opaque
From: vicente.botet_at_[hidden]
Date: 2010-09-24 17:27:38


Author: viboes
Date: 2010-09-24 17:27:35 EDT (Fri, 24 Sep 2010)
New Revision: 65583
URL: http://svn.boost.org/trac/boost/changeset/65583

Log:
Opaque: Rename operators helper classes following ConceptTraits naming
Text files modified:
   sandbox/opaque/boost/opaque/opaque_type.hpp | 14 +-
   sandbox/opaque/boost/opaque/operators.hpp | 171 ++++++++++++++++++++++++++++++++++++---
   2 files changed, 162 insertions(+), 23 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-24 17:27:35 EDT (Fri, 24 Sep 2010)
@@ -25,13 +25,13 @@
             , boost::integer_arithmetic< Final
               , boost::bitwise< Final
                 , boost::unit_steppable< Final
- , opaque::less_than_comparable<Final
- , opaque::ope::eq<Final
- , opaque::addable<Final
- , opaque::subtractable<Final
- , opaque::multipliable<Final
- , opaque::dividable<Final
- , opaque::modable<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 >
>
>

Modified: sandbox/opaque/boost/opaque/operators.hpp
==============================================================================
--- sandbox/opaque/boost/opaque/operators.hpp (original)
+++ sandbox/opaque/boost/opaque/operators.hpp 2010-09-24 17:27:35 EDT (Fri, 24 Sep 2010)
@@ -19,45 +19,49 @@
 namespace boost {
 
 namespace opaque {
+namespace ope {
     template <typename Base=base_new_type>
- struct non_copyable : Base {
+ struct copy_delete : Base {
     private: // emphasize the following members are private
- non_copyable( const non_copyable& );
+ copy_delete( const copy_delete & );
     };
 
     template <typename Base=base_new_type>
- struct non_assignable : Base {
+ struct assign_delete : Base {
     private: // emphasize the following members are private
- non_assignable& operator=(non_assignable const&);
+ assign_delete& operator=(assign_delete const&);
     };
 
     template <typename UT, typename Base=base_new_type>
- struct convertible : Base {
+ struct conversion : Base {
         operator UT() const{
                 return this->underlying();
         }
     };
 
     template <typename Final, typename Base=base_new_type>
- struct less_than_comparable : Base {
+ struct less_than : Base {
         friend bool operator<(const Final& x, const Final& y) {
             return x.underlying() < y.underlying();
         }
     };
 
- namespace ope {
     template <typename Final, typename Base=base_new_type>
- struct eq : Base {
+ struct equal : Base {
         friend bool operator==(const Final& x, const Final& y) {
             return x.underlying() == y.underlying();
         }
     };
- }
+
     template <typename Final, typename Base=base_new_type>
- struct equality_comparable1 : boost::equality_comparable1<Final, ope::eq<Final, Base> > {};
+ struct not_equal : Base {
+ friend bool operator!=(const Final& x, const Final& y) {
+ return x.underlying() != y.underlying();
+ }
+ };
 
     template <typename Final, typename Base=base_new_type>
- struct addable : Base {
+ struct plus_assign : Base {
         friend Final& operator+=(Final& x, const Final& y) {
             x.underlying() += y.underlying();
             return x;
@@ -65,15 +69,15 @@
     };
 
     template <typename Final, typename Base=base_new_type>
- struct subtractable : Base {
+ struct minus_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 multipliable : Base {
+ struct multiply_assign : Base {
         friend Final& operator*=(Final& x, const Final& y) {
             x.underlying() *= y.underlying();
             return x;
@@ -81,7 +85,7 @@
     };
 
     template <typename Final, typename Base=base_new_type>
- struct dividable : Base {
+ struct divide_assign : Base {
         friend Final& operator/=(Final& x, const Final& y) {
             x.underlying() /= y.underlying();
             return x;
@@ -89,12 +93,147 @@
     };
 
     template <typename Final, typename Base=base_new_type>
- struct modable : Base {
+ struct modulus_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 bitwise_xor_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 bitwise_and_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 bitwise_or_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>
+ struct logical_not : Base {
+ friend bool operator!(Final const& x) {
+ return !(x.underlying());
+ }
+ };
+
+ template <typename Final, typename Base=base_new_type>
+ struct unary_plus : Base {
+ 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) {
+ 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 {
+ //~ friend Final const& operator&(Final const& x) {
+ //~ return &x;
+ //~ }
+ //~ };
+
+ template <typename Final, typename Base=base_new_type>
+ struct derreference : Base {
+ friend Final& operator*(Final const& x) {
+ return Final(~(x.underlying()));
+ }
+ };
+
+
+ // Increment and decrement
+ template <typename Final, typename Base=base_new_type>
+ struct pre_increment : Base {
+ friend Final& operator++(Final& x) {
+ ++x.underlying();
+ return x;
+ }
+ };
+
+ template <typename Final, typename Base=base_new_type>
+ struct pre_decrement : Base {
+ friend Final& operator++(Final& x) {
+ ++x.underlying();
+ return x;
+ }
+ };
+
+ template <typename Final, typename Base=base_new_type>
+ struct post_increment : Base {
+ friend Final operator++(Final& x, int) {
+ typename Final::underlying_type nrv(x);
+ ++x;
+ return nrv;
+ }
+ };
+
+ template <typename Final, typename Base=base_new_type>
+ struct post_decrement : Base {
+ friend Final operator--(Final& x, int) {
+ typename Final::underlying_type nrv(x);
+ --x;
+ return nrv;
+ }
+ };
+
+}
+
+ 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> > {};
+
 
 }
 }


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