Does opSlice work with immutable values?

Joseph Cassman jc7919 at outlook.com
Mon Feb 24 10:05:01 PST 2014


On Monday, 24 February 2014 at 17:24:18 UTC, Ali Çehreli wrote:
> On 02/24/2014 09:11 AM, Joseph Cassman wrote:
>
> > the const keyword added to a [member] function makes the this
> pointer
> > const. Can't see exactly why this works but it does.
>
> const means "I will not modify data through this reference". 
> Since there is not issue with modification, it can refer to 
> mutable and immutable data.
>
> Ali
>
> P.S. It would be great if you could show the issue on a minimal 
> code example. I tried to look at your original code but found 
> it to be too long. Sorry... :)

Thanks for the explanation.
Yeah, wasn't sure whether the entire context would be better than 
providing a meaningless reduced code example. :P
See what I can do.

Joseph


More information about the Digitalmars-d-learn mailing list