I have a particular type name and that type may or may not be const and/or immutable. How do I make a new type based on this that is mutable, ie getting rid of both const and immutable, but not knowing what the original type is ?

I don’t want to repeat information from the definition of the original type as this would introduce a bug if the original definition is later changed.


Something like

alias immutable_cash_t = immutable(float);
alias mutable_cash_t = float;

// better, in case the original were ever to be changed from ‘float’ to ‘real’ some day alias mutable_cash_t = GetRidOfImmutable!( GetRidOfConst!( mutable_cash_t ) );
  • Getting rid of const/immu... Cecil Ward via Digitalmars-d-learn

Reply via email to