ae.utils.array

Array utility functions

Public Imports

ae.utils.aa
public import ae.utils.aa;
Undocumented in source.
ae.utils.appender
public import ae.utils.appender;
Undocumented in source.

Members

Aliases

queuePush
alias queuePush = stackPush
Undocumented in source.

Functions

afilter
auto afilter(T[] arr)
Undocumented in source. Be warned that the author may not have intended to support it.
amap
auto amap(T[] arr)
Undocumented in source. Be warned that the author may not have intended to support it.
asort
auto asort(T[] arr)
Undocumented in source. Be warned that the author may not have intended to support it.
auniq
auto auniq(T[] arr)
Undocumented in source. Be warned that the author may not have intended to support it.
contains
bool contains(T[] arr, V val)
Undocumented in source. Be warned that the author may not have intended to support it.
countSort
T[] countSort(T[] arr)
Undocumented in source. Be warned that the author may not have intended to support it.
eat
bool eat(T[] arr, T[] prefix)

If arr starts with prefix, slice it off and return true. Otherwise leave arr unchaned and return false.

eatUntil
T[] eatUntil(T[] arr, T[] separator)

Return arr until the first instance of separator (excluding it), and set arr to the remaining part (again, excluding the separator). Throws if the separator is not found.

get
T get(T[] arr, size_t index)

Like AA.get - soft indexing, throws an Exception (not an Error) on out-of-bounds, even in release builds.

get
auto get(T[] arr, size_t index, T defaultValue)

Like AA.get - soft indexing, returns default value on out-of-bounds.

isIn
bool isIn(T val, T[] arr)
Undocumented in source. Be warned that the author may not have intended to support it.
isOneOf
bool isOneOf(T val, T[] arr)
Undocumented in source. Be warned that the author may not have intended to support it.
memcmp
int memcmp(ubyte[] a, ubyte[] b)
Undocumented in source. Be warned that the author may not have intended to support it.
memmove
void memmove(T[] dst, T[] src)

Like std.algorithm.copy, but without the auto-decode bullshit. https://issues.dlang.org/show_bug.cgi?id=13650

padRight
T[] padRight(T[] s, size_t l, T c)
Undocumented in source. Be warned that the author may not have intended to support it.
pluck
T pluck(T[] arr)

Select and return a random element from the array, and remove it from the array.

queuePeek
T queuePeek(T[] arr)
Undocumented in source. Be warned that the author may not have intended to support it.
queuePeekLast
T queuePeekLast(T[] arr)
Undocumented in source. Be warned that the author may not have intended to support it.
queuePop
T queuePop(T[] arr)
Undocumented in source. Be warned that the author may not have intended to support it.
repeatOne
T[] repeatOne(T c, size_t l)
Undocumented in source. Be warned that the author may not have intended to support it.
sample
auto ref sample(T[] arr)

Select and return a random element from the array.

shift
T shift(T[] arr)
Undocumented in source. Be warned that the author may not have intended to support it.
slice
T[] slice(T[] arr, size_t p0, size_t p1)

Slices an array. Throws an Exception (not an Error) on out-of-bounds, even in release builds.

stackPeek
T stackPeek(T[] arr)
Undocumented in source. Be warned that the author may not have intended to support it.
stackPop
T stackPop(T[] arr)
Undocumented in source. Be warned that the author may not have intended to support it.
stackPush
void stackPush(T[] arr, T val)
Undocumented in source. Be warned that the author may not have intended to support it.
toArray
T[] toArray(T v)

Slice a variable.

unshift
void unshift(T[] arr, T value)
Undocumented in source. Be warned that the author may not have intended to support it.
vector
T[] vector(T[] a, T[] b)
Undocumented in source. Be warned that the author may not have intended to support it.
vectorAssign
T[] vectorAssign(T[] a, T[] b)
Undocumented in source. Be warned that the author may not have intended to support it.

Properties

bytes
inout(ubyte)[] bytes [@property getter]

Return the value represented as an array of bytes.

Meta

License

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

Authors

Vladimir Panteleev <vladimir@thecybershadow.net>