FilterMembersOf

Filters all the members of a type based on a provided predicate

The predicate takes two parameters - the first is the type, the second is the string name of the member being iterated on.

Members

Aliases

FilterMembersOf
alias FilterMembersOf = Filter!(ApplyLeft!(Fn, ResolvedType), __traits(allMembers, ResolvedType))
Undocumented in source.
ResolvedType
alias ResolvedType = ResolvePointer!T
Undocumented in source.

Examples

import std.meta: AliasSeq;

struct S {
    int i;
    float f;
    int i2;
    short s;
}

enum hasInt(T, string name) = is(typeof(__traits(getMember, T, name)) == int);
static assert(FilterMembersOf!(S, hasInt) == AliasSeq!("i", "i2"));

Meta