Logical const

Sean Kelly sean at invisibleduck.org
Tue Nov 30 09:10:03 PST 2010


Steven Schveighoffer Wrote:

> On Tue, 30 Nov 2010 10:06:40 -0500, Don <nospam at nospam.com> wrote:
> 
> >
> > What are the use cases for logical const? Are there any other important  
> > ones, apart from caching?
> 
> Being able to associate data with an object/struct without owning the  
> data.  Deep in this thread I give an example of having a widget who knows  
> its location and knows how to draw itself in that location.  Such a  
> function cannot be marked const even though no widget data is changed,  
> since the draw function is not const.  But the Widget doesn't own the  
> location, it's just referencing it.

Hm... can a const object mutate globals?


More information about the Digitalmars-d mailing list