Boost logo

Boost Users :

From: Bernard Maassen (bmaassen_at_[hidden])
Date: 2008-02-20 08:36:34


Hi all

i'm porting a program written in visual studio 2005 to vs 2003, and came to
a problem i can't
fix.

The idea is to have a lock a mutex while a object excists. The code is:

template <class B>
  class BaseReadLockProxy
  {
  private:
    const B& base;
    typename B::MutexType::scoped_lock baseScoped_lock;

  public:
    BaseReadLockProxy(const B& b):
      base(b),
      baseScoped_lock( B::MutexType::scoped_lock(b.baseMutex))
    {
    }

    typename const B::ContainerType& getItems()
    {
      return base.getItems();
    }

    ~BaseReadLockProxy()
    {
    }
  };

Where B::MutexType: typedef boost::mutex MutexType;

When compiling this gives:

e:\stage2\2apl\2aplcore\BaseScopeLockedProxy.h(39) : error C2558: class
'boost::detail::thread::scoped_lock<Mutex>' : no copy constructor available
or copy constructor is declared 'explicit'
        with
        [
            Mutex=boost::mutex
        ]
        e:\stage2\2apl\2aplcore\BaseScopeLockedProxy.h(36) : while compiling
class-template member function
'doubleapl::BaseReadLockProxy<B>::BaseReadLockProxy(const B &)'
        with
        [
            B=doubleapl::PRRuleBase
        ]
        RuleOption.cpp(112) : see reference to class template instantiation
'doubleapl::BaseReadLockProxy<B>' being compiled
        with
        [
            B=doubleapl::PRRuleBase
        ]

I know it should work, because it compiles/runs when using visual studio
2005.
Does anyone have an idea what could cause this problem?

All ideas are welcome, cause i'm totally stuck



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net