Cast to left hand side
    tcak via Digitalmars-d-learn 
    digitalmars-d-learn at puremagic.com
       
    Sun Nov  9 10:59:59 PST 2014
    
    
  
In some cases, I need to cast right hand side expression to left 
hand side. While it looks/feels simple for basic data types, it 
requires long lines with duplication when flexible code is 
desired to be written.
Example:
int a = 7;
byte b;
b = cast( byte )a;
When I want to create a system where data types should match each 
other automatically, my code turns into this.
b = cast( typeof( b ) )a;
Alright, in my use cases, variable names "a" and "b" are long 
with module names mostly.
Is there any way to cast to type of left hand side variable the 
right side?
    
    
More information about the Digitalmars-d-learn
mailing list