const property don't wont return const reference to value
Namespace
rswhite4 at googlemail.com
Sun Dec 23 06:41:09 PST 2012
On Sunday, 23 December 2012 at 13:37:33 UTC, Rainer Schuetze
wrote:
>
>
> On 23.12.2012 14:20, Zhenya wrote:
>> @property const ref int bar() const
>
> The first const does not bind to the return type, but to the
> whole declaration, so it does the same as the const at the end.
> You should use
>
> @property ref const(int) bar() const
Shouldn't we fix this? Most of the Newcomer are confused with the
fact, that there are two ways to define a function/method as
const and that they have to write const(ReturnType) and not const
ReturnType.
More information about the Digitalmars-d-learn
mailing list