Re: [Boost-bugs] [Boost C++ Libraries] #10128: Use lockable_adapter with const objects or const members

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #10128: Use lockable_adapter with const objects or const members
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-07-08 08:44:04


#10128: Use lockable_adapter with const objects or const members
-------------------------------+----------------------
  Reporter: anonymous | Owner: viboes
      Type: Feature Requests | Status: assigned
 Milestone: To Be Determined | Component: thread
   Version: Boost 1.54.0 | Severity: Problem
Resolution: | Keywords:
-------------------------------+----------------------

Comment (by anonymous):

 I could derive lockable_adapter to lockable_adapter2 and use its const
 members.


 {{{

 template <typename BasicLockable>
 class basic_lockable_adapter2 :
     public boost::basic_lockable_adapter<BasicLockable>
 {
 public:
 basic_lockable_adapter2()
 {}

 void lock() const
 {
     lockable().lock();
 }
 void unlock() const
 {
     lockable().unlock();
 }

 };

 class Class1 :
     public basic_lockable_adapter2<boost::recursive_mutex>
 {
 public:
     Class1() :_i(0){}
     virtual ~Class1(){}

     void set(int i) {
         _i = i;
     }

     int get() const {
         return _i;
     }

 private:
     int _i;
 };
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/10128#comment:10>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:16 UTC