member

Used to extract details about a specific member

Available member traits:

  • exists
  • self
  • isProperty
  • protection
  • Members

    Manifest constants

    exists
    enum exists;

    True if the member field exists

    isProperty
    enum isProperty;
    Undocumented in source.
    isProperty
    enum isProperty;
    Undocumented in source.
    propertySemantics
    enum propertySemantics;
    Undocumented in source.
    protection
    enum protection;
    Undocumented in source.

    Templates

    self
    template self()
    Undocumented in source.

    Examples

    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);

    Meta