traits_ex

Various extensions to std.traits.

Members

Aliases

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

Is ElementType of type of a.

allTypesSame
alias allTypesSame = allSameType
Undocumented in source.
elTypeOf
alias elTypeOf = ElementTypeOf
Undocumented in source.
greaterThan
alias greaterThan = binaryFun!((a, b) => a > b)
Undocumented in source.
inGC
alias inGC = isGCPointer
Undocumented in source.
isEven
alias isEven = unaryFun!(a => (a & 1) == 0)
Undocumented in source.
isGCed
alias isGCed = isGCPointer
Undocumented in source.
isHomogeneous
alias isHomogeneous = allSameType
Undocumented in source.
isOdd
alias isOdd = unaryFun!(a => (a & 1) == 1)
Undocumented in source.
isRange
alias isRange = isInputRange
Undocumented in source.
isSink
alias isSink = isOutputRange
Undocumented in source.
isSinkOf
alias isSinkOf = isOutputRangeOf
Undocumented in source.
isSomeCharSource
alias isSomeCharSource = isSourceOfSomeChar
Undocumented in source.
isSomeLazyString
alias isSomeLazyString = isSourceOfSomeChar
Undocumented in source.
isSomeStringSource
alias isSomeStringSource = isSourceOfSomeString
Undocumented in source.
isSource
alias isSource = isInputRange
Undocumented in source.
isSourceOf
alias isSourceOf = isInputRangeOf
Undocumented in source.
lessThan
alias lessThan = binaryFun!((a, b) => a < b)
Undocumented in source.

Enums

allSameType1
eponymoustemplate allSameType1(T...)
Undocumented in source.
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. See also: http://forum.dlang.org/thread/owlwzvidwwpsrelpkbok@forum.dlang.org

isCallableWith
eponymoustemplate isCallableWith(alias fun, T)

TODO Unite into a variadic. See also: http://forum.dlang.org/thread/bfjwbhkyehcloqcjzxck@forum.dlang.org#post-atjmewbffdzeixrviyoa:40forum.dlang.org

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.
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.
isNotEquable
eponymoustemplate isNotEquable(T)
Undocumented in source.
isOpBinary
eponymoustemplate isOpBinary(T, string op, U)

See also: http://forum.dlang.org/thread/bug-6384-3@http.d.puremagic.com/issues/ See also: http://forum.dlang.org/thread/jrqiiicmtpenzokfxvlz@forum.dlang.org

isOutputRangeOf
eponymoustemplate isOutputRangeOf(R, E)
Undocumented in source.
isRandomAccessRangeOf
eponymoustemplate isRandomAccessRangeOf(R, E)

Useful aliases for combinations of range predicates.

isReferenceType
eponymoustemplate isReferenceType(T)
Undocumented in source.
isSignedIntegral
eponymoustemplate isSignedIntegral(T)
Undocumented in source.
isSourceOfSomeChar
eponymoustemplate isSourceOfSomeChar(R)
Undocumented in source.
isSourceOfSomeString
eponymoustemplate isSourceOfSomeString(R)
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)

Return Tuple tup as a Dynamic Array.

asStaticArray
inout(T.Types[0])[T.length] asStaticArray(T tup)

Return Tuple tup as a Static Array. See also: http://dpaste.dzfl.pl/d0059e6e6c09

enumMembers
auto enumMembers()

Dynamic Variant of EnumMembers. See also: http://forum.dlang.org/thread/bspwlfypfishykezzocx@forum.dlang.org#post-dguqnroxbfewerepomwq:40forum.dlang.org

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

Move std.uni.newLine? TODO What to do with Windows style endings? See also: https://en.wikipedia.org/wiki/Newline

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.

uniqueEnumMembers
auto uniqueEnumMembers()

Dynamic Variant of EnumMembers without Enumerator Aliases. See also: http://forum.dlang.org/thread/bspwlfypfishykezzocx@forum.dlang.org#post-dguqnroxbfewerepomwq:40forum.dlang.org

Templates

Chainable
template Chainable()
Undocumented in source.
allSame
template allSame(V...)
allSameIterative
template allSameIterative(V...)
Undocumented in source.
allSameRecursive
template allSameRecursive(V...)
Undocumented in source.
allSameType
template allSameType(T...)
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 See also: https://github.com/D-Programming-Language/phobos/pull/1672/files

dimensionality
template dimensionality(T)

Get Dimensionality of Type T. See also: http://forum.dlang.org/thread/hiuhqdxtpifhzwebewjh@forum.dlang.org?page=2

isA
template isA(alias S, T)

Returns true if T is an instance of the template S. See also: http://forum.dlang.org/thread/mailman.2901.1316118301.14074.digitalmars-d-learn@puremagic.com#post-zzdpfhsgfdgpszdbgbbt:40forum.dlang.org

isCTFEable
template isCTFEable(alias fun)

Check if Function expr is callable at compile-time. See also: http://forum.dlang.org/thread/owlwzvidwwpsrelpkbok@forum.dlang.org

isCTFEable2
template isCTFEable2(fun...)
Undocumented in source.
isNullable
template isNullable(T)

Note that NotNull!T is not isNullable :)

isSortedRange
template isSortedRange(T)

Check if T is a Sorted Range. See also: http://forum.dlang.org/thread/lt1g3q$15fe$1@digitalmars.com

isType
template isType(T)
Undocumented in source.
isType
template isType(alias T)
Undocumented in source.
packedBitSizeOf
template packedBitSizeOf(T)

Get Number of Bits Required to store an instance of T. See also: http://forum.dlang.org/thread/okonqhnxzqlqtxijxsfg@forum.dlang.org

sizesOf
template sizesOf(T...)
Undocumented in source.
stringsOf
template stringsOf(T...)
Undocumented in source.

Variables

haveCommonType
enum bool haveCommonType(Types...);
Undocumented in source.
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.

Meta

Authors

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