Boost logo

Boost Users :

From: Darren Vincent Hart (dvhart_at_[hidden])
Date: 2003-06-10 09:04:16


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 :-) )

Thanks for the time,

Darren Hart
dvhart_at_[hidden]

On Tue, 2003-06-10 at 01:43, Russell Hind wrote:
> > logger.cpp:36: error: no matching function for call to `
> > boost::detail::thread::scoped_lock<boost::mutex>::scoped_lock(const
> > boost::mutex&)'
>
> If the mutex is a member variable, then in the const method, it is a
> const mutex. scoped_lock requires a non-const mutex. This is what is
> causing the error.
>
> Declare the mutex as mutable so it appears as non-const even in const
> members. (I don't know if this is the preferred way, but it is the way
> I currently use).
>
> It works if the mutex is declared in the .cpp because it is not part of
> the class, and therefore isn't const when accessed inside a const method.
>
> HTH
>
> Russell
>
>
>
>
>
> Info: <http://www.boost.org>
> Wiki: <http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl>
> Unsubscribe: <mailto:boost-users-unsubscribe_at_[hidden]>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>


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