Thread overview | |||||
---|---|---|---|---|---|
|
March 24, 2009 getting mutable type from T | ||||
---|---|---|---|---|
| ||||
How can I get the mutable type from any type T in a generic function or template, assuming T is const or immutable? |
March 24, 2009 Re: getting mutable type from T | ||||
---|---|---|---|---|
| ||||
Posted in reply to Lutger | On Tue, Mar 24, 2009 at 6:33 AM, Lutger <lutger.blijdestijn@gmail.com> wrote:
> How can I get the mutable type from any type T in a generic function or template, assuming T is const or immutable?
>
>
>
std.traits.Mutable!(T).
|
March 24, 2009 Re: getting mutable type from T | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jarrett Billingsley | Jarrett Billingsley wrote:
..
> std.traits.Mutable!(T).
Ah thanks! Too obvious.
In case somebody would like to know:
static if (is(T U == const(U)))
alias U Mutable;
else static if (is(T U == immutable(U)))
alias U Mutable;
|
Copyright © 1999-2021 by the D Language Foundation