toString why not const

Jesse Phillips jessekphillips+D at gmail.com
Fri Jan 21 14:38:34 PST 2011


Tom Wrote:

> Hi, I'm trying to override Object's toString. I've noted it isn't a 
> const method, namely:
> 
> string toString() const;
> 
> This cause me troubles when using it on a const reference.
> 
> Shouldn't it be const?
> 
> Thanks,
> Tom;

Phobos hasn't become very const aware. There have been bugs and things preventing such an effort. So I do believe it should be const, but between the other priorities, and possible signature change for toString, it isn't done yet.


More information about the Digitalmars-d-learn mailing list