auto + Top-level Const/Immutable
dsimcha
dsimcha at yahoo.com
Tue Dec 20 10:16:26 PST 2011
On Tuesday, 20 December 2011 at 17:46:40 UTC, Jonathan M Davis
wrote:
> Assuming that the assignment can still take place, then making
> auto infer non-
> const and non-immutable would be an improvement IMHO. However,
> there _are_ cases where you'd have to retain const - a prime
> example being classes. But value types could have
> const/immutable stripped from them, as could arrays using their
> tail-constness.
>
> - Jonathan M Davis
Right. The objects would only be head de-constified if Michael
Fortin's patch to allow such things got in. A simple way of
explaining this would be "auto removes top level const from the
type T if T implicitly converts to the type that would result".
More information about the Digitalmars-d
mailing list