const, auto and struct/class methods

bearophile bearophileHUGS at lycos.com
Mon Nov 25 03:00:06 PST 2013


Joseph Rushton Wakeling:

>      struct Foo
>      {
>           const(auto) bar()
>           {
>               // modifies internal data of Foo
>               // but returns a const type
>           }
>      }

Is this acceptable?

struct Foo {
     auto bar() {
         const result = ...;
         return result;
     }
}

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list