On Wednesday, 30 August 2017 at 21:15:56 UTC, Kagamin wrote:
Something like mixin("__traits(getProtection, A."~member~")")

The following compiles without error. It would be nice if something like this got added to std.traits.

template getProtection(string from, string member)
{
    mixin("static import " ~ from ~ ";");
    enum string getProtection =
mixin("__traits(getProtection, " ~ from ~ "." ~ member ~ ")");
}

@safe unittest
{
    assert(getProtection!("std.algorithm", "map") == "public");
}

Reply via email to