memberIsVisibleAndNotDeprecated

Eponymous template; aliases itself to true if the passed member of the passed aggregate Thing is not private and not deprecated.

template memberIsVisibleAndNotDeprecated (
Thing
string memberstring
) {
static if(!isType!Thing)
enum pattern;
static if(!isType!Thing)
enum message;
static if(!(!isType!Thing))
static if(!isAggregateType!Thing)
enum pattern;
static if(!(!isType!Thing))
static if(!isAggregateType!Thing)
enum message;
static if(!(!isType!Thing))
static if(!(!isAggregateType!Thing))
static if(!memberstring.length)
enum message;
static if(!(!isType!Thing))
static if(!(!isAggregateType!Thing))
static if(!(!memberstring.length))
static if(!__traits(isDeprecated, __traits(getMember, Thing, memberstring)) && __traits(compiles, __traits(getVisibility, __traits(getMember, Thing, memberstring))) && ((__traits(getVisibility, __traits(getMember, Thing, memberstring)) != "private") && (__traits(getVisibility, __traits(getMember, Thing, memberstring)) != "package")))
enum memberIsVisibleAndNotDeprecated;
static if(!(!isType!Thing))
static if(!(!isAggregateType!Thing))
static if(!(!memberstring.length))
static if(!(!__traits(isDeprecated, __traits(getMember, Thing, memberstring)) && __traits(compiles, __traits(getVisibility, __traits(getMember, Thing, memberstring))) && ((__traits(getVisibility, __traits(getMember, Thing, memberstring)) != "private") && (__traits(getVisibility, __traits(getMember, Thing, memberstring)) != "package"))))
enum memberIsVisibleAndNotDeprecated;
}

Members

Imports

format (from std.format)
public import std.format : format;
Undocumented in source.
format (from std.format)
public import std.format : format;
Undocumented in source.
format (from std.format)
public import std.format : format;
Undocumented in source.
isAggregateType (from std.traits)
public import std.traits : isAggregateType, isType;
Undocumented in source.
isType (from std.traits)
public import std.traits : isAggregateType, isType;
Undocumented in source.

Parameters

Thing

Some aggregate.

memberstring

String name of the member of Thing that we want to check the visibility and deprecationness of.

Examples

struct Foo
{
    public int i;
    private bool b;
    package string s;
    deprecated public int di;
}

class Bar
{
    public int i;
    private bool b;
    package string s;
    deprecated public int di;
}

static assert( memberIsVisibleAndNotDeprecated!(Foo, "i"));
static assert(!memberIsVisibleAndNotDeprecated!(Foo, "b"));
static assert(!memberIsVisibleAndNotDeprecated!(Foo, "s"));
static assert(!memberIsVisibleAndNotDeprecated!(Foo, "di"));

static assert( memberIsVisibleAndNotDeprecated!(Bar, "i"));
static assert(!memberIsVisibleAndNotDeprecated!(Bar, "b"));
static assert(!memberIsVisibleAndNotDeprecated!(Bar, "s"));
static assert(!memberIsVisibleAndNotDeprecated!(Bar, "di"));