Boost logo

Boost Users :

From: Richard Damon (rdamon_at_[hidden])
Date: 2003-10-21 22:02:52

> -----Original Message-----
> From: boost-users-bounces_at_[hidden] [mailto:boost-users-
> bounces_at_[hidden]] On Behalf Of Mark Sizer
> Sent: Tuesday, October 21, 2003 10:04 PM
> To: boost-users_at_[hidden]
> Subject: [Boost-users] Re: Condition variable and const-correctness
> I say that the difference between physical const and logical const is
> EXACTLY what you are saying it is: A logically const method does not
> change the internal state of the object. A phyically const method does
> not modify any members of the object. A phyically const method is
> necessarily logically const. The converse may not be true. The
> distinction is that a logically, but not physically, const method
> requires "mutable" member variables to compile.

Actually a physically const method might not be logically const. Take for
example a string class which has a pointer to a buffer which holds the
string (plus maybe some other bookkeeping members). The data pointed to is
logically part of the object but is not physically part of it. A physically
const method may not change the pointer, but is allowed to change the data
pointed to by the pointer as this data is not "physically part of the
object", but such an operation is not logically const.

Richard Damon

rbrdamon_at_[hidden] (Home)
rdamon_at_[hidden] (Work)

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at