Best practices for logical const

Meta jared771 at gmail.com
Sat Feb 15 19:17:48 PST 2014


On Sunday, 16 February 2014 at 03:16:16 UTC, Steven Schveighoffer 
wrote:
> On Sat, 15 Feb 2014 22:04:25 -0500, Meta <jared771 at gmail.com> 
> wrote:
>
>> Obviously this is extremely contrived, but inout is 
>> effectively logical const here. Is there no way to know what 
>> the "original" mutability of t is at compile-time?
>
> No, because only one version of the function is generated. That 
> is part of the benefit of inout over a template.
>
> If you DO want to know whether it's mutable, use a template.
>
> -Steve

If you pass a mutable value to a function taking an inout 
parameter, what's the difference between that function and an 
identical function that takes a regular mutable parameter instead 
of an inout parameter?


More information about the Digitalmars-d mailing list