Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r55295 - sandbox/fmhess/boost/generic_ptr
From: fmhess_at_[hidden]
Date: 2009-07-30 14:45:35


Author: fmhess
Date: 2009-07-30 14:30:18 EDT (Thu, 30 Jul 2009)
New Revision: 55295
URL: http://svn.boost.org/trac/boost/changeset/55295

Log:
Fixed various compile errors.

Text files modified:
   sandbox/fmhess/boost/generic_ptr/monitor.hpp | 29 +++++++++++++++++------------
   1 files changed, 17 insertions(+), 12 deletions(-)

Modified: sandbox/fmhess/boost/generic_ptr/monitor.hpp
==============================================================================
--- sandbox/fmhess/boost/generic_ptr/monitor.hpp (original)
+++ sandbox/fmhess/boost/generic_ptr/monitor.hpp 2009-07-30 14:30:18 EDT (Thu, 30 Jul 2009)
@@ -14,6 +14,8 @@
 #ifndef BOOST_GENERIC_PTR_MONITOR_HPP_INCLUDED
 #define BOOST_GENERIC_PTR_MONITOR_HPP_INCLUDED
 
+#include <boost/generic_ptr/monitor_locks.hpp> // for monitor_unique_lock
+#include <boost/generic_ptr/pointer_cast.hpp>
 #include <boost/generic_ptr/pointer_traits.hpp>
 #include <boost/generic_ptr/detail/unique_lock.hpp>
 #include <boost/generic_ptr/shared.hpp>
@@ -34,8 +36,8 @@
       class moveable_monitor_lock
       {
       public:
- moveable_monitor_lock(T p, Mutex &m): _object_p(p),
- _lock(new detail::unique_lock<Mutex>(m))
+ moveable_monitor_lock(const monitor& mon): _object_p(mon.px),
+ _lock(new detail::unique_lock<Mutex>(mon.get_mutex_ref()))
         {}
         T operator->() const
         {
@@ -70,10 +72,10 @@
       monitor(const monitor<U, Mutex> & other): px(other.px), _mutex_p(other._mutex_p)
       {}
 #ifndef BOOST_NO_RVALUE_REFERENCES
- monitor(monitor && other): px(std::move(other.px)), _mutex_p(std::move(other._mutex_p)
+ monitor(monitor && other): px(std::move(other.px)), _mutex_p(std::move(other._mutex_p))
       {}
       template<typename U>
- monitor(monitor<U> && other): px(std::move(other.px)), _mutex_p(std::move(other._mutex_p)
+ monitor(monitor<U> && other): px(std::move(other.px)), _mutex_p(std::move(other._mutex_p))
       {}
 #endif
 
@@ -126,7 +128,7 @@
 
       moveable_monitor_lock operator->() const
       {
- return moveable_monitor_lock(px, *_mutex_p);
+ return moveable_monitor_lock(*this);
       }
 
     private:
@@ -148,25 +150,28 @@
       mpl::identity<ToValueType> to_type_iden = mpl::identity<ToValueType>()
     )
     {
- return static_pointer_cast(p.get(), to_type_iden);
+ typedef typename rebind<monitor<U, Mutex>, ToValueType>::other result_type;
+ return result_type(static_pointer_cast(p.get(), to_type_iden), p.get_shared_mutex());
     }
     template<typename ToValueType, typename U, typename Mutex>
     typename rebind<monitor<U, Mutex>, ToValueType>::other const_pointer_cast
     (
- monitor<U, Mutex> const & p,
- mpl::identity<ToValueType> to_type_iden = mpl::identity<ToValueType>()
+ monitor<U, Mutex> const & p,
+ mpl::identity<ToValueType> to_type_iden = mpl::identity<ToValueType>()
     )
     {
- return const_pointer_cast(p.get(), to_type_iden);
+ typedef typename rebind<monitor<U, Mutex>, ToValueType>::other result_type;
+ return result_type(const_pointer_cast(p.get(), to_type_iden), p.get_shared_mutex());
     }
     template<typename ToValueType, typename U, typename Mutex>
     typename rebind<monitor<U, Mutex>, ToValueType>::other dynamic_pointer_cast
     (
- monitor<U, Mutex> const & p,
- mpl::identity<ToValueType> to_type_iden = mpl::identity<ToValueType>()
+ monitor<U, Mutex> const & p,
+ mpl::identity<ToValueType> to_type_iden = mpl::identity<ToValueType>()
     )
     {
- return dynamic_pointer_cast(p.get(), to_type_iden);
+ typedef typename rebind<monitor<U, Mutex>, ToValueType>::other result_type;
+ return result_type(dynamic_pointer_cast(p.get(), to_type_iden), p.get_shared_mutex());
     }
 
     // comparisons


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