10 Jun
2003
10 Jun
'03
7:43 a.m.
logger.cpp:36: error: no matching function for call to ` boost::detail::thread::scoped_lockboost::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