Template member
Used to extract details about a specific member
template member(Params...)
;
Available member traits:
exists
self
isProperty
protection
Contained Aliases
Name | Description |
---|---|
self | Aliases to the member if it exists |
Parameters
Name | Description |
---|
Example
import bolts .traits: ProtectionLevel, PropertySemantics;
static struct S {
public int publicI;
protected int protectedI;
private @property int readPropI() { return protectedI; }
}
// Check the protection level of various members
static assert(member!(S, "publicI") .protection == ProtectionLevel .public_);
static assert(member!(S, "protectedI") .protection == ProtectionLevel .protected_);
static assert(member!(S, "readPropI") .protection == ProtectionLevel .private_);
// Check if any are properties
static assert(!member!(S, "na") .isProperty);
static assert(!member!(S, "publicI") .isProperty);
static assert( member!(S, "readPropI") .isProperty);
// Check their semantics
static assert(member!(S, "readPropI") .propertySemantics == PropertySemantics .r);