iz.sugar

Several trivial functions and structures

Members

Enums

IdMode
enum IdMode

Deep iteration mode

MaskKind
enum MaskKind

Enumerates the possible units of a mask.

Functions

applyWrap
string applyWrap(ref R returns)

Scans the method wrapped by the caller.

bruteCast
auto bruteCast(auto ref IT it)

Allows forbidden casts.

compare
bool compare(auto ref L lhs, auto ref R rhs)

Compares two integral values with additional static checkings.

constCall
auto constCall(Aggr aggr, auto ref A a)

Allows to call a non const method as if it was const.

deepIterate
bool deepIterate(Range range, auto ref A a)

Iterates a tree-like structure that exposes an input range interface and calls each element with a function.

dropBackWhile
auto dropBackWhile(auto ref Range range)

Convenience function that calls popBackWhile() on the input argument and returns the consumed range to allow function pipelining. In addition this wrapper accepts rvalues.

dropWhile
auto dropWhile(auto ref Range range)

Convenience function that calls popWhile() on the input argument and returns the consumed range to allow function pipelining. In addition this wrapper accepts rvalues.

flipFlop
auto flipFlop(auto ref R1 flip, auto ref R2 flop)

Returns a lazy input range that alterntively returns the state of one of two sub-ranges.

getDelegate
auto getDelegate(void* context, FT code)

Sets the context and the function of a new delegate.

mask
auto mask(const T value)

Masks, at compile-time, a byte, a nibble or a bit in the argument.

mask
auto mask(const T value, size_t index)

Masks, at run-time, a byte, a nibble or a bit in the argument.

maskBit
auto maskBit(const T value)

Compile-time mask() partially specialized for bit-masking.

maskBit
auto maskBit(const T value, size_t index)

Run-time mask() partially specialized for bit-masking.

maskNibble
auto maskNibble(const T value)

Compile-time mask() partially specialized for nibble-masking.

maskNibble
auto maskNibble(const T value, size_t index)

Run-time mask() partially specialized for nibble-masking.

mutatedCount
size_t mutatedCount(Range range)

Indicates how many elements of a range are mutated.

pickAndCall
bool pickAndCall(T t, Fun fun, auto ref A a)

Calls a function according to a probability

popBackWhile
void popBackWhile(ref Range range)

Pops back an input range while a predicate is true. Consumes the input argument.

popWhile
void popWhile(ref Range range)

Pops an input range while a predicate is true. Consumes the input argument.

rValue
auto rValue(auto ref T t)

Allows to pass always a parameter as value even if it would be accepted as reference.

recursion
auto recursion(auto ref A a)

Allows to call recursively the function being executed.

reset
void reset(ref T t)

Void version of the init() type function.

safeAccess
auto ref safeAccess(M m)

IFTI helper for SafeAccess.

setDelegate
void setDelegate(ref T t, void* context, FT code)

Sets the context and the function of a delegate.

takeBackWhile
auto takeBackWhile(auto ref Range range)

Returns a lazy input range that takes from the input tail while a predicate is verified and the input is not empty.

takeWhile
auto takeWhile(auto ref Range range)

Returns a lazy input range that takes from the input while a predicate is verified and the input is not empty.

throwStaticEx
void throwStaticEx()
void throwStaticEx()

Throws a static exception, suitable for @nogc functions.

Structs

ArrayRange
struct ArrayRange(T, bool assumeDecoded = false, bool infinite = false)

Alternative to std.range primitives for arrays.

CoercionSafeFloat
struct CoercionSafeFloat(T)

Wraps a floating point type that doesn't follow D permissive float conversion rules.

SafeAccess
struct SafeAccess(M)

Allows to build access chains of class members as done with the ?. operator in other languages. In the chain, any null member that is a class instance or that returns one, has for effect to shortcut the complete evaluation.

Wrap
struct Wrap

Used the annotate the member functions that wrap other member functions. Each instance must specify aither the type, the instance and the name of the function that's wrapped or the name of a context-free function. Each string must be colon-separated.

Templates

bitCast
template bitCast(T, S)

Safely cast a value of a type to another, if both have the same size.

Unions

Delegate
union Delegate(FT)

The delegate union is a conveniant way to setup non gc delegates that are compatible with D delegates.

Variables

canImport
enum bool canImport(string mod);

Determines if a module can be imported, allowing to create optional static branches.

Meta