checked

Convenience function that turns an integral into the corresponding Checked instance by using template argument deduction. The hook type may be specified (by default Abort).

Checked!(T, Hook)
checked
(
Hook = Abort
T
)
(
const T value
)
if (
is(typeof(Checked!(T, Hook)(value)))
)

Parameters

Hook

type that customizes the behavior, by default Abort

T

type represetinfg the underlying represantion of the Checked instance

value T

the actual value of the representation

Return Value

Type: Checked!(T, Hook)

A Checked instance customized by the provided Hook and value

Examples

static assert(is(typeof(checked(42)) == Checked!int));
assert(checked(42) == Checked!int(42));
static assert(is(typeof(checked!WithNaN(42)) == Checked!(int, WithNaN)));
assert(checked!WithNaN(42) == Checked!(int, WithNaN)(42));

Meta