memberIsMutable

As the name suggests, aliases itself to true if the passed member of the passed aggregate Thing is mutable, which includes that it's not an enum.

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

Members

Imports

isMutable (from std.traits)
public import std.traits : isMutable;
Undocumented in source.

Manifest constants

memberIsMutable
enum memberIsMutable;
Undocumented in source.

Parameters

Thing

Some aggregate.

memberstring

String name of the member of Thing that we want to determine is a non-enum mutable.

Examples

struct Foo
{
    int i;
    const bool b;
    immutable string s;
    enum float f = 3.14;
}

class Bar
{
    int i;
    const bool b;
    immutable string s;
    enum float f = 3.14;
}

static assert( memberIsMutable!(Foo, "i"));
static assert(!memberIsMutable!(Foo, "b"));
static assert(!memberIsMutable!(Foo, "s"));
static assert(!memberIsMutable!(Foo, "f"));

static assert( memberIsMutable!(Bar, "i"));
static assert(!memberIsMutable!(Bar, "b"));
static assert(!memberIsMutable!(Bar, "s"));
static assert(!memberIsMutable!(Bar, "f"));

Meta