[Issue 18969] 'need this for <function>' when passing field or method as template parameter

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jun 20 07:19:51 UTC 2018


https://issues.dlang.org/show_bug.cgi?id=18969

--- Comment #1 from Simen Kjaeraas <simen.kjaras at gmail.com> ---
Related:

import std.meta : Alias;
alias getMember(alias T, string name) = Alias!(__traits(getMember, T, name));

struct S {
    int i = 0;
}

unittest {
    S s;
    getMember!(s, "i") = 2;
}

--


More information about the Digitalmars-d-bugs mailing list