toString why not const

2011-01-21 Thread Tom
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;

Re: toString why not const

2011-01-21 Thread Jesse Phillips
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

Re: toString why not const

2011-01-21 Thread Jonathan M Davis
On Friday, January 21, 2011 13:02:56 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; It's a long-st

Re: toString why not const

2011-01-21 Thread bearophile
Jesse Phillips: > So I do believe it should be const, but between the other priorities, and > possible signature change for toString, it isn't done yet. There also the idea of introducing the writeTo() standard method, that's neat :-) Bye, bearophile