$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r60507 - sandbox/stm/branches/vbe/boost/stm/tx
From: vicente.botet_at_[hidden]
Date: 2010-03-12 01:52:23
Author: viboes
Date: 2010-03-12 01:52:22 EST (Fri, 12 Mar 2010)
New Revision: 60507
URL: http://svn.boost.org/trac/boost/changeset/60507
Log:
Boost.STM/vbe: 
* Replace the conversion operator T&() by all the possible operators modifying the proxy_cache.
Text files modified: 
   sandbox/stm/branches/vbe/boost/stm/tx/proxy_cache.hpp |   159 ++++++++++++++++++++++++++++++++++++--- 
   1 files changed, 146 insertions(+), 13 deletions(-)
Modified: sandbox/stm/branches/vbe/boost/stm/tx/proxy_cache.hpp
==============================================================================
--- sandbox/stm/branches/vbe/boost/stm/tx/proxy_cache.hpp	(original)
+++ sandbox/stm/branches/vbe/boost/stm/tx/proxy_cache.hpp	2010-03-12 01:52:22 EST (Fri, 12 Mar 2010)
@@ -55,9 +55,136 @@
         ref()=rhs.value();
         return *this;
     }
+    template<typename F, typename U>
+    proxy_cache& operator+=(proxy_cache<F,U> const& rhs) {
+        ref()+=rhs.value();
+        return *this;
+    }
+    template<typename U>
+    proxy_cache& operator+=(U const& rhs) {
+        ref()+=rhs;
+        return *this;
+    }
        
+    template<typename F, typename U>
+    proxy_cache& operator-=(proxy_cache<F,U> const& rhs) {
+        ref()-=rhs.value();
+        return *this;
+    }
+    template<typename U>
+    proxy_cache& operator-=(U const& rhs) {
+        ref()-=rhs;
+        return *this;
+    }
+
+    template<typename F, typename U>
+    proxy_cache& operator*=(proxy_cache<F,U> const& rhs) {
+        ref()*=rhs.value();
+        return *this;
+    }
+    template<typename U>
+    proxy_cache& operator*=(U const& rhs) {
+        ref()*=rhs;
+        return *this;
+    }
+
+    template<typename F, typename U>
+    proxy_cache& operator/=(proxy_cache<F,U> const& rhs) {
+        ref()/=rhs.value();
+        return *this;
+    }
+    template<typename U>
+    proxy_cache& operator/=(U const& rhs) {
+        ref()/=rhs;
+        return *this;
+    }
+
+    template<typename F, typename U>
+    proxy_cache& operator%=(proxy_cache<F,U> const& rhs) {
+        ref()%=rhs.value();
+        return *this;
+    }
+    template<typename U>
+    proxy_cache& operator%=(U const& rhs) {
+        ref()%=rhs;
+        return *this;
+    }
+
+    template<typename F, typename U>
+    proxy_cache& operator^=(proxy_cache<F,U> const& rhs) {
+        ref()^=rhs.value();
+        return *this;
+    }
+    template<typename U>
+    proxy_cache& operator^=(U const& rhs) {
+        ref()^=rhs;
+        return *this;
+    }
+
+    template<typename F, typename U>
+    proxy_cache& operator&=(proxy_cache<F,U> const& rhs) {
+        ref()&=rhs.value();
+        return *this;
+    }
+    template<typename U>
+    proxy_cache& operator&=(U const& rhs) {
+        ref()&=rhs;
+        return *this;
+    }
+
+    template<typename F, typename U>
+    proxy_cache& operator|=(proxy_cache<F,U> const& rhs) {
+        ref()|=rhs.value();
+        return *this;
+    }
+    template<typename U>
+    proxy_cache& operator|=(U const& rhs) {
+        ref()|=rhs;
+        return *this;
+    }
+
+    template<typename F, typename U>
+    proxy_cache& operator>>=(proxy_cache<F,U> const& rhs) {
+        ref()>>=rhs.value();
+        return *this;
+    }
+    template<typename U>
+    proxy_cache& operator>>=(U const& rhs) {
+        ref()>>=rhs;
+        return *this;
+    }
+
+    template<typename F, typename U>
+    proxy_cache& operator<<=(proxy_cache<F,U> const& rhs) {
+        ref()<<=rhs.value();
+        return *this;
+    }
+    template<typename U>
+    proxy_cache& operator<<=(U const& rhs) {
+        ref()<<=rhs;
+        return *this;
+    }
+
+
+    proxy_cache& operator++() {
+        ++ref();
+        return *this;
+    }
+
+    T operator++(int) {
+        return ref()++;
+    }
+
+    proxy_cache& operator--() {
+        --ref();
+        return *this;
+    }
+    T operator--(int) {
+        return ref()--;
+    }
+    
     operator T() const { return value(); }
-    operator T&() { return ref(); }
+    //operator T&() { return ref(); }
 
     //-----------------------------------------------------------------------------
     // accessors
@@ -102,18 +229,24 @@
     // TODO add case has_shallow_copy_semansics<T> is true
 };
 
-//~ template <typename OSTREAM, typename F, typename T, typename B>
-//~ OSTREAM& operator<<(OSTREAM& os, proxy_cache<F, T, B> const& r) {
-    //~ os << r.value();
-    //~ return os;
-//~ }
-//~ template <typename ISTREAM, typename F, typename T, typename B>
-//~ ISTREAM& operator>>(ISTREAM& is, proxy_cache<F, T, B> & r) {
-    //~ T v;
-    //~ is >> v;
-    //~ r=v;
-    //~ return is;
-//~ }
+template <typename Final, typename T, typename Base>
+typename proxy_cache<Final,Base>::value_type& 
+ref(proxy_cache<Final,Base>& r) {
+    return r.ref();
+}
+
+template <typename OSTREAM, typename F, typename T, typename B>
+OSTREAM& operator<<(OSTREAM& os, proxy_cache<F, T, B> const& r) {
+    os << r.value();
+    return os;
+}
+template <typename ISTREAM, typename F, typename T, typename B>
+ISTREAM& operator>>(ISTREAM& is, proxy_cache<F, T, B> & r) {
+    T v;
+    is >> v;
+    r=v;
+    return is;
+}
 
 
 }