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
) {
static if(!isAggregateType!Thing)
enum pattern;
static if(!isAggregateType!Thing)
enum message;
static if(!(!isAggregateType!Thing))
static if(!memberstring.length)
enum message;
static if(!(!isAggregateType!Thing))
static if(!(!memberstring.length))
enum memberIsMutable;
}

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.
isAggregateType (from std.traits)
public import std.traits : isAggregateType, isMutable;
Undocumented in source.
isMutable (from std.traits)
public import std.traits : isAggregateType, isMutable;
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"));