On Fri, Nov 06, 2020 at 07:17:53PM +0000, Selim Ozel via Digitalmars-d-learn 
wrote:
> On Thursday, 5 November 2020 at 22:36:36 UTC, Anonymouse wrote:
> > If I'm not mistaken the `csvReader` function returns a range struct,
> > and the full type is something long and unwieldy like
> > `CsvReader!(struct_type1, cast(Malformed)1, string, dchar,
> > string[])`.  So just think of `records` as being that.
> 
> I actually first going this route but couldn't figure out the correct
> name for that data type. It is quite long.
[...]

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

-- 
Guns don't kill people. Bullets do.

Reply via email to