www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - getting mutable type from T

reply Lutger <lutger.blijdestijn gmail.com> writes:
How can I get the mutable type from any type T in a generic function or 
template, assuming T is const or immutable?
Mar 24 2009
parent reply Jarrett Billingsley <jarrett.billingsley gmail.com> writes:
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).
Mar 24 2009
parent Lutger <lutger.blijdestijn gmail.com> writes:
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;
Mar 24 2009