Boost logo

Boost Users :

From: Russell Hind (yg-boost-users_at_[hidden])
Date: 2003-06-10 09:41:25


Darren Vincent Hart wrote:
> That did the trick, many thanks. So why is it that the error talked
> about argument types when it *should* have reported me attempting to
> change a member variable within a const context ? (I admit to feeling a
> bit abashed at the problem however :-) )
>

The compiler is correct with its error (whether it is a helpful
diagnostic or not). You are passing a const mutex to an method that
expects a mutex. Its like passing an int to method that expects a string.

const mutex

is a different type than

mutex.

So that is why the error is about argument types. You weren't actually
attempting to modify a const object yourself was, but scoped_lock
explicitly states that it wants a 'mutex', not a 'const mutex' so that
is the error the compiler was displaying

C++ compiler errors aren't always the most helpful, but they are logical
(usually)

Russell


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