nxt.array_algorithm

Array-only overloads of Phobos algorithms.

Functions are when possible @safe pure nothrow @nogc. Haystack parameter is when possible and relevant scope return inout(T)[] and DIP-1000-compliant. Needle parameter is either scope const(T)[] or scope const T[].

Provides more than twice as fast compilation for char-arrays (strings).

Members

Functions

all
bool all(T[] haystack, T needle)

Array-specialization of all with element needle.

any
bool any(T[] haystack, T needle)

Array-specialization of any with element needle.

canFind
bool canFind(T[] haystack, T[] needle)
bool canFind(T[] haystack, T needle)

Array-specialization of count with default predicate.

count
size_t count(T[] haystack, T[] needle)
size_t count(T[] haystack, T needle)

Array-specialization of count with default predicate.

count
size_t count(T[] haystack)

Array-specialization of count with default predicate and no needle.

endsWith
bool endsWith(T[] haystack, T[] needle)
bool endsWith(T[] haystack, T needle)

Array-specialization of endsWith with default predicate.

endsWithEither
bool endsWithEither(T[] haystack, T[][] needles)
Undocumented in source. Be warned that the author may not have intended to support it.
endsWithEither
bool endsWithEither(T[] haystack, T[] needles)

Array-specialization of endsWith with default predicate.

findLastSkip
auto findLastSkip(inout(T)[] haystack, T[] needle)

Array-specialization of findSkip with default predicate that finds the last skip.

findLastSkip
auto findLastSkip(inout(T)[] haystack, T needle)
findLastSplit
auto findLastSplit(inout(T)[] haystack, const(T)[] needle)
auto findLastSplit(inout(T)[] haystack, T needle)

Array-specialization of findLastSplit with default predicate.

findLastSplitAfter
auto findLastSplitAfter(inout(T)[] haystack, T needle)

Array-specialization of findLastSplitAfter with default predicate.

findSkip
auto findSkip(inout(T)[] haystack, T[] needle)
auto findSkip(inout(T)[] haystack, T needle)

Array-specialization of findSkip with default predicate.

findSplit
auto findSplit(inout(T)[] haystack, const(T)[] needle)
auto findSplit(inout(T)[] haystack, T needle)

Array-specialization of findSplit with default predicate.

findSplitAfter
auto findSplitAfter(inout(T)[] haystack, T needle)

Array-specialization of findSplitAfter with default predicate.

findSplitBefore
auto findSplitBefore(inout(T)[] haystack, T needle)

Array-specialization of findSplitBefore with default predicate.

findSplitBefore
auto findSplitBefore(inout(T)[] haystack)

Array-specialization of findSplitBefore with explicit needle-only predicate needlePred.

indexOf
ptrdiff_t indexOf(inout(T)[] haystack, const(T)[] needle)
ptrdiff_t indexOf(inout(T)[] haystack, T needle)
indexOfEither
ptrdiff_t indexOfEither(inout(T)[] haystack, T[] needles)

Array-specialization of indexOf with default predicate.

lastIndexOf
ptrdiff_t lastIndexOf(inout(T)[] haystack, const(T)[] needle)
ptrdiff_t lastIndexOf(inout(T)[] haystack, T needle)

Array-specialization of lastIndexOf with default predicate.

main
void main()
Undocumented in source. Be warned that the author may not have intended to support it.
skipOver
bool skipOver(inout(T)[] haystack, T[] needle)
bool skipOver(inout(T)[] haystack, T needle)

Array-specialization of skipOver with default predicate.

skipOverAround
bool skipOverAround(inout(T)[] haystack, T[] needleFront, T[] needleBack)
Undocumented in source. Be warned that the author may not have intended to support it.
skipOverAround
bool skipOverAround(inout(T)[] haystack, T needleFront, T needleBack)

Array-specialization of skipOverBack with default predicate.

skipOverBack
bool skipOverBack(inout(T)[] haystack, T[] needle)
bool skipOverBack(inout(T)[] haystack, T needle)

Array-specialization of skipOverBack with default predicate.

startsWith
bool startsWith(T[] haystack, T[] needle)
bool startsWith(T[] haystack, T needle)

Array-specialization of startsWith with default predicate.

strip
inout(T)[] strip(inout(T)[] haystack, T needle)
inout(char)[] strip(inout(char)[] haystack)

Array-specialization of strip with default predicate.

stripLeft
inout(T)[] stripLeft(inout(T)[] haystack, T needle)
inout(char)[] stripLeft(inout(char)[] haystack)

Array-specialization of stripLeft with default predicate.

stripRight
inout(T)[] stripRight(inout(T)[] haystack, T needle)
inout(char)[] stripRight(inout(char)[] haystack)

Array-specialization of stripRight with default predicate.

See Also

https://forum.dlang.org/post/sjirukypxmmcgdmqbcpe@forum.dlang.org https://forum.dlang.org/thread/ybamybeakxwxwleebnwb@forum.dlang.org?page=1

TODO: Merge into separate array-specializations of Phobos algorithms for less template bloat in Phobos.

Meta