-----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users- bounces@lists.boost.org] On Behalf Of Mark Sizer Sent: Wednesday, October 22, 2003 12:45 PM To: boost-users@lists.boost.org Subject: [Boost-users] Re: [OT a bit] Condition variable and const- correctness
Richard Damon wrote: Ooops. You are correct. I consider this a language bug. Take the following:
The issue is that the compiler will only enforce "Physical" constness as this is all it knows. The compiler can not know if the object pointed to is part of the objects logical state or not. This is also why we have mutable, so we can let the compiler know that some parts can be changed without effecting the "logical value" of the object. Your sample is a little off. You call the following to code sequences identical: _paMine->rkiValue() and raMine().rkiValue() there is a significant difference, the first just accesses the pointer (which is const because you are in a const member function), the second takes the const pointer and tries to put it through a non-const reference before calling the const member function. You need to either use rkaMine() to tell the compiler you don't want the non-const ref, or rename rkaMine() to raMine() so you let the compilers overload resolution mechanisms determine by context if you can get the non-const reference. Richard Damon -- rbrdamon@rcn.com (Home) rdamon@beltronicsinc.com (Work)