Module bolts

Contains a number of static reflection utilties that query compile time entities (traits) or transform them (meta). General utilties are in the modules traits and meta and most specific ones are in dedicated modules (i.e. bolts.members provides utilities over a type's members).

Most functions here operate on any compile time entity. For example isUnaryOver works in both these situatons:

int i;
void f(int) {}
isFunctionOver!(f, int);
isFunctionOver!(f, 3);
isFunctionOver!(f, i);

Iz Super Template

The iz super template. Has a lot of the traits on types encapulated in one place. So if there's a trait that tells you something about a compile time entity, chances are iz will have it. E.g:

void f(int, float, string) {}
iz!f.unaryOver!(int, float, string);
iz!f.unaryOver!(3, float, "");

Member Super Template

The member super template, found in the bolts.members module is similar to the iz template but works on members of types only:

import bolts.members: member;
struct S {
    static void f() {}
}
assert(member!(S, "f").exists);
assert(member!(S, "f").protection == ProtectionLevel.public_);
assert(!member!(S, "f").isProperty);

All the things

Module Function Description
bolts.from from lazy import of modules
bolts.members memberFunctionsOf Returns a list of all member functions
staticMembersOf Returns a list of of all static members
member If a type has a member with certain attributes
bolts.meta TypesOf Returns an AliasSeq of the types of all values given - values can be types or expressions
Flatten Takes a list of ranges and non ranges and returns a list of types of the ranges and types of the non ranges
AliasPack Represents an AliasSeq that is not auto expanded
staticZip Zip m n-tuple AliasPacks together to form n m-tuple AliasPacks
FilterMembersOf Filters the members of a type based on a has-predicate
bolts.traits isFunctionOver Checks if a function is n-ary over the passed in types
isUnaryOver Checks if a function is unary over some type
isBinaryOver Checks if a function is binary over some types
areCombinable Checks if a set of ranges and non ranges share a common type
isProperty Tells you if a symbol is an @property
hasProperty Tells you if a name is a member and property in a type
propertySemantics Tells you if a property symbol has read and/or write semantics
protectionLevel Returns the protection level for a symbol
isManifestAssignable If a member of a type can be assigned to a manifest constant
isOf Is the resolved type is of another resolved type
isNullType If T is typeof(null)
isNullable if null can be assigned to an instance of type T
StringOf Stringifies a type, unlike .stringof this version doesn't spit out mangled gibberish
isSame Returns true if a and b are the same thing - same type, same literal value, or same symbol
isRefType Checks if a compile time entity is a reference type
isValueType Checks if a compile time entity is a value type
isLiteralOf Checks if a compile time entity is a litera of a specific type
isLiteral Checks if a compile time entity is a literal
isCopyConstructable Checks if a compile time entity is copy constructable
isNonTriviallyCopyConstructable Checks if a compile time entity is non-trivially (i.e. user defined) copy constructable
isTriviallyCopyConstructable Checks if a compile time entity is trivially copy constructable
hasFunctionMember Checks if a type has a member that is a function
bolts.range isSortedRange Tells you if a range is sorted
sortingPredicate Can be used to extract the sorting predicate for a range
CommonTypeOfRanges Finds the common type from a list of ranges
bolts.iz iz Allows you to query a type or alias with a nicer syntax, i.e. isNullable!T == iz!T.nullable