Switch between two structs with csvreader

Selim Ozel sozel at wpi.edu
Sat Nov 7 15:32:26 UTC 2020


On Friday, 6 November 2020 at 19:35:47 UTC, H. S. Teoh wrote:
> You can use the typeof() operator to capture the type of a 
> long, unwieldy type in an alias. This is useful if you ever 
> need to store such a return type somewhere, e.g.:
>
> 	alias T = typeof(csvReader(...));
>
> 	struct MyStorage {
> 		T result;
> 	}
>
> 	MyStorage s;
> 	s.result = csvReader(...);
>
> Let the compiler figure out the type for you. :-)
>
>
> T

That's great, thanks!

S




More information about the Digitalmars-d-learn mailing list