memberIsVisibleAndNotDeprecated

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

Compilers previous to 2.096 need to flip the order of the checks (visibility first, deprecations second), whereas it doesn't matter for compilers 2.096 onwards. If the order isn't flipped though we get deprecation warnings. Having it this way means we get the visibility/deprecation check we want on all (supported) compiler versions, but regrettably deprecation messages on older compilers. Unsure where the breakpoint is.

template memberIsVisibleAndNotDeprecated (
Thing
string memberstring
) if (
isAggregateType!Thing &&
memberstring.length
) {}

Members

Manifest constants

memberIsVisibleAndNotDeprecated
enum memberIsVisibleAndNotDeprecated;
Undocumented in source.
memberIsVisibleAndNotDeprecated
enum memberIsVisibleAndNotDeprecated;
Undocumented in source.
memberIsVisibleAndNotDeprecated
enum memberIsVisibleAndNotDeprecated;
Undocumented in source.
memberIsVisibleAndNotDeprecated
enum memberIsVisibleAndNotDeprecated;
Undocumented in source.
memberIsVisibleAndNotDeprecated
enum memberIsVisibleAndNotDeprecated;
Undocumented in source.
memberIsVisibleAndNotDeprecated
enum memberIsVisibleAndNotDeprecated;
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"));

Meta