nxt.traits_ex

Various extensions to std.traits.

Members

Aliases

ElementTypeOf
alias ElementTypeOf(alias a) = ElementType!(typeof(a))

Is ElementType of type of a.

Enums

allSameType_alternative
eponymoustemplate allSameType_alternative(T...)
hasEvenLength
eponymoustemplate hasEvenLength(T...)

Check if T has an even length.

isCTEable
eponymoustemplate isCTEable(alias expr)

Check if the value of expr is known at compile-time.

isCallableWith
eponymoustemplate isCallableWith(alias fun, T)

TODO Unite into a variadic.

isHeterogeneous
eponymoustemplate isHeterogeneous(T)

Returns true if at least one type in the Tuple T is not the same as the others.

isIterableOf
eponymoustemplate isIterableOf(R, E)

Useful aliases for combinations of range predicates.

isLvalue
eponymoustemplate isLvalue(alias sym)

Is true if sym is an l-value, false otherwise.

isOpBinary
eponymoustemplate isOpBinary(T, string op, U)
isRandomAccessRangeOf
eponymoustemplate isRandomAccessRangeOf(R, E)

Useful aliases for combinations of range predicates.

isRvalue
eponymoustemplate isRvalue(alias sym)

Is true if sym is an l-value, false otherwise.

Functions

asDynamicArray
auto asDynamicArray(T tup)
enumMembersAsEnumerators
T[] enumMembersAsEnumerators()

Dynamic variant of EnumMembers returning enum member constants (enumerators) of T.

isGCPointer
bool isGCPointer(T* ptr)
isNewline
bool isNewline(C c)

Move std.uni.newLine? TODO What to do with Windows style endings?

persistentlyMemoizedCall
auto persistentlyMemoizedCall(T args)

Persistently Call Function fun with arguments args.

propertySemantics
auto propertySemantics()

Tells you if a name is a read and/or write property

uniqueEnumMembers
auto uniqueEnumMembers()

Dynamic Variant of EnumMembers excluding the enumerator aliases.

Templates

EntropyBitsOf
template EntropyBitsOf(T)

Get entropy in number of bits of T.

allSameIterative
template allSameIterative(V...)
allSameRecursive
template allSameRecursive(V...)
allSameTypeRecursive
template allSameTypeRecursive(V...)
allSameTypeRecursive2
template allSameTypeRecursive2(V...)

Variant of allSameTypeRecursive.

allSameTypesInTuple
template allSameTypesInTuple(T)

Returns true if all types in the Tuple T are the same. TODO: Remove when this is merged: https://github.com/D-Programming-Language/phobos/pull/3395

dimensionality
template dimensionality(T)

Get Dimensionality of Type T.

hasDisabledPostblit
template hasDisabledPostblit(T)

Is true iff the postblit of T is disabled (@disable this(this)).

hasPropertyFunction
template hasPropertyFunction(T, string name)

Is true iff T has a property member non-function named name.

isA
template isA(alias S, T)

Returns true if T is an instance of the template S.

isCTFEable
template isCTFEable(alias fun)

Check if Function expr is callable at compile-time.

isManifestAssignable
template isManifestAssignable(T, string name)

Is true if T.name is a manifest constant, built-in type field, or immutable static.

isSortedRange
template isSortedRange(T)

Check if T is a Sorted Range.

isTemplateInstance
template isTemplateInstance(T)
rank
template rank(T)

Rank of type T.

templateIdentifierOf
template templateIdentifierOf(I)

Get identifier (name) string of template instance I, or null if I is not a template instance.

Variables

haveCommonType
enum bool haveCommonType(Types...);

Is true iff Types all share a common type.

isNogc
enum bool isNogc(alias fun);

Check if fun is a @nogc function.

isPure
enum bool isPure(alias fun);

Check if fun is a pure function.

isPurelyCallableWith
enum bool isPurelyCallableWith(alias fun, T...);

Check if fun is a function purely callable with arguments T.

isRefIterable
enum bool isRefIterable(T);

Is true if R is iterable over references to its elements.

See Also

http://forum.dlang.org/thread/jbyixfbuefvdlttnyclu@forum.dlang.org#post-mailman.2199.1353742037.5162.digitalmars-d-learn:40puremagic.com http://forum.dlang.org/post/rjrdgmijsmvvsbpinidz@forum.dlang.org

Meta