View source code
Display the source code in std/traits.d from which this page was generated on github.
Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using local clone.

Alias std.traits.Unsigned

alias Unsigned(T) = ModifyTypePreservingTQ!(Impl,OriginalType!T);

Parameters

NameDescription
T A built in integral or vector type.

Returns

The corresponding unsigned numeric type for T with the same type qualifiers.

If T is not a integral or vector, a compile-time error is given.

Example

static assert(is(Unsigned!(int) == uint));
static assert(is(Unsigned!(long) == ulong));
static assert(is(Unsigned!(const short) == const ushort));
static assert(is(Unsigned!(immutable byte) == immutable ubyte));
static assert(is(Unsigned!(inout int) == inout uint));

Example

Unsigned types are forwarded

static assert(is(Unsigned!(uint) == uint));
static assert(is(Unsigned!(const uint) == const uint));

static assert(is(Unsigned!(ubyte) == ubyte));
static assert(is(Unsigned!(immutable uint) == immutable uint));

Authors

Walter Bright, Tomasz Stachowiak (isExpressions), Andrei Alexandrescu, Shin Fujishiro, Robert Clipsham, David Nadlinger, Kenji Hara, Shoichi Kato

License

Boost License 1.0.