On Wed, 24 Dec 2014 09:32:05 +0000 via Digitalmars-d <[email protected]> wrote:
> On Wednesday, 24 December 2014 at 09:02:56 UTC, Kagamin wrote:
> > If you require another variable for a sanitized version of `n`,
> > you get confused, when to use `n` and when to use `x`, they are
>
> Btw, this is case where preventing shadowing becomes an issue, as
> you could have solved this easily using immutable shadowing:
>
> func(immutable int n){
> @trustmeiwantoshadowthis immutable n = sanitize(n);
> ...
> }
void myFunc(T) (T numm) if (isIntegral!numm) {
static if (isMutable!numm) alias num = numm;
else auto num = cast(Unqual!T)numm;
...
}
heh. catched a bug in my code with immutable ints recently, wrote the
quoted snippet. ;-)
signature.asc
Description: PGP signature
