nxt.traits_ex

Various extensions to std.traits.

Members

Aliases

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

Is ElementType of type of a.

allSame
alias allSame = allSameIterative
Undocumented in source.
allSameType
alias allSameType = allSameTypeIterative
Undocumented in source.
greaterThan
alias greaterThan = binaryFun!((a, b) => a > b)
Undocumented in source.
isEven
alias isEven = unaryFun!(a => (a & 1) == 0)
Undocumented in source.
isHomogeneousType
alias isHomogeneousType = allSame
Undocumented in source.
isOdd
alias isOdd = unaryFun!(a => (a & 1) == 1)
Undocumented in source.
isSomeLazyString
alias isSomeLazyString = isSourceOfSomeChar
Undocumented in source.
isSomeStringSource
alias isSomeStringSource = isSourceOfSomeString
Undocumented in source.
lessThan
alias lessThan = binaryFun!((a, b) => a < b)
Undocumented in source.
templateNameOf
alias templateNameOf = templateIdentifierOf
Undocumented in source.

Enums

allSameType_alternative
eponymoustemplate allSameType_alternative(T...)
areComparable
eponymoustemplate areComparable(T, U)
Undocumented in source.
areEquable
eponymoustemplate areEquable(T, U)
Undocumented in source.
areNotEquable
eponymoustemplate areNotEquable(T, U)
Undocumented in source.
arityMin0
eponymoustemplate arityMin0(alias fun)
Undocumented in source.
hasEvenLength
eponymoustemplate hasEvenLength(T...)

Check if T has an even length.

hasValueSemantics
eponymoustemplate hasValueSemantics(T)
Undocumented in source.
isArrayOf
eponymoustemplate isArrayOf(R, E)
Undocumented in source.
isArrayOfSomeString
eponymoustemplate isArrayOfSomeString(R)
Undocumented in source.
isBidirectionalRangeOf
eponymoustemplate isBidirectionalRangeOf(R, E)
Undocumented in source.
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.

isCallableWith
eponymoustemplate isCallableWith(alias fun, T, U)
Undocumented in source.
isClass
eponymoustemplate isClass(T)
Undocumented in source.
isComparable
eponymoustemplate isComparable(T)
Undocumented in source.
isConst
eponymoustemplate isConst(T)
Undocumented in source.
isDString
eponymoustemplate isDString(T)
Undocumented in source.
isEnum
eponymoustemplate isEnum(T)
Undocumented in source.
isEquable
eponymoustemplate isEquable(T)
Undocumented in source.
isForwardRangeOf
eponymoustemplate isForwardRangeOf(R, E)
Undocumented in source.
isHeterogeneous
eponymoustemplate isHeterogeneous(T)

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

isHomogeneousTuple
eponymoustemplate isHomogeneousTuple(T)
Undocumented in source.
isHomogeneousTupleOf
eponymoustemplate isHomogeneousTupleOf(T, E)
Undocumented in source.
isInputRangeOf
eponymoustemplate isInputRangeOf(R, E)
Undocumented in source.
isInputRangeOfUnqual
eponymoustemplate isInputRangeOfUnqual(R, E)
Undocumented in source.
isInterface
eponymoustemplate isInterface(T)
Undocumented in source.
isIterableOf
eponymoustemplate isIterableOf(R, E)

Useful aliases for combinations of range predicates.

isIterableOfSomeString
eponymoustemplate isIterableOfSomeString(R)
Undocumented in source.
isIterableOfUnqual
eponymoustemplate isIterableOfUnqual(R, E)
Undocumented in source.
isLvalue
eponymoustemplate isLvalue(alias sym)

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

isNotEquable
eponymoustemplate isNotEquable(T)
Undocumented in source.
isOpBinary
eponymoustemplate isOpBinary(T, string op, U)
isOutputRangeOf
eponymoustemplate isOutputRangeOf(R, E)
Undocumented in source.
isRandomAccessRangeOf
eponymoustemplate isRandomAccessRangeOf(R, E)

Useful aliases for combinations of range predicates.

isRange
eponymoustemplate isRange(R)
Undocumented in source.
isReferenceType
eponymoustemplate isReferenceType(T)
Undocumented in source.
isRvalue
eponymoustemplate isRvalue(alias sym)

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

isSignedIntegral
eponymoustemplate isSignedIntegral(T)
Undocumented in source.
isSink
eponymoustemplate isSink(R)
Undocumented in source.
isSinkOf
eponymoustemplate isSinkOf(R, E)
Undocumented in source.
isSource
eponymoustemplate isSource(R)
Undocumented in source.
isSourceAssignableTo
eponymoustemplate isSourceAssignableTo(R, E)
Undocumented in source.
isSourceOf
eponymoustemplate isSourceOf(R, E)
Undocumented in source.
isSourceOfSomeChar
eponymoustemplate isSourceOfSomeChar(R)
Undocumented in source.
isSourceOfSomeString
eponymoustemplate isSourceOfSomeString(R)
Undocumented in source.
isSourceOfUnqual
eponymoustemplate isSourceOfUnqual(R, E)
Undocumented in source.
isString
eponymoustemplate isString(T)
Undocumented in source.
isStruct
eponymoustemplate isStruct(T)
Undocumented in source.
isUnsignedIntegral
eponymoustemplate isUnsignedIntegral(T)
Undocumented in source.
isValueType
eponymoustemplate isValueType(T)
Undocumented in source.
isWString
eponymoustemplate isWString(T)
Undocumented in source.
nameOf
eponymoustemplate nameOf(alias a)
Undocumented in source.
sizeOf
eponymoustemplate sizeOf(T)
Undocumented in source.
stringOf
eponymoustemplate stringOf(T)
Undocumented in source.

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?

isNewline
bool isNewline(S s)
Undocumented in source. Be warned that the author may not have intended to support it.
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

Chainable
template Chainable()
Undocumented in source.
EntropyBitsOf
template EntropyBitsOf(T)

Get entropy in number of bits of T.

allSameIterative
template allSameIterative(V...)
allSameRecursive
template allSameRecursive(V...)
allSameTypeHybrid
template allSameTypeHybrid(V...)
Undocumented in source.
allSameTypeIterative
template allSameTypeIterative(V...)
Undocumented in source.
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

allSatisfyIterative
template allSatisfyIterative(alias F, T...)
Undocumented in source.
anySatisfyIterative
template anySatisfyIterative(alias F, T...)
Undocumented in source.
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.

isCTFEable2
template isCTFEable2(fun...)
Undocumented in source.
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.

isSubclassOf
template isSubclassOf(Class, BaseClass)
Undocumented in source.
isTemplateInstance
template isTemplateInstance(T)
isType
template isType(T)
Undocumented in source.
isType
template isType(alias T)
Undocumented in source.
ownsItsElements
template ownsItsElements(C)
Undocumented in source.
rank
template rank(T)

Rank of type T.

sizesOf
template sizesOf(T...)
Undocumented in source.
stringsOf
template stringsOf(T...)
Undocumented in source.
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