Transitive const sucks

Steven Schveighoffer schveiguy at yahoo.com
Wed Sep 12 07:26:45 PDT 2007


"Gregor Richards" wrote
> Steven Schveighoffer wrote:
>> class X
>> {
>>   const int void f()
>>   {
>>     x += 5;
>>     return x;
>>   }
>> }
>
> "const int void f()" is clearly a bad declaration. Anyway, "const int f()" 
> is a function returning a const int, not a const function returning an 
> int, so you wouldn't be able to call it through a const reference.
>
>  - Gregor Richards

Um... yeah, I meant to say f() is const.  Sorry my example code didn't 
compile for you :P

-Steve





More information about the Digitalmars-d mailing list