ContainerStorageType

Undocumented in source.

Members

Aliases

ContainerStorageType
alias ContainerStorageType = Unqual!T
Undocumented in source.
ContainerStorageType
alias ContainerStorageType = Rebindable!T
Undocumented in source.
ContainerStorageType
alias ContainerStorageType = U
Undocumented in source.
ContainerStorageType
alias ContainerStorageType = T
Undocumented in source.
U
alias U = Unqual!T
Undocumented in source.

Examples

static assert (is (ContainerStorageType!(int) == int));
static assert (is (ContainerStorageType!(const int) == int));
import std.typecons : Rebindable;
static assert (is (ContainerStorageType!(Object) == Object));
static assert (is (ContainerStorageType!(const(Object)) == Rebindable!(const(Object))));
struct A { int foo; }
struct B { void opAssign(typeof(this)) { this.foo *= 2; }  int foo;}

// A can be stored easily because it is plain data
static assert (is (ContainerStorageType!(A) == A));
static assert (is (ContainerStorageType!(const(A)) == A));

// const(B) cannot be stored in the container because of its
// opAssign. Casting away const could lead to some very unexpected
// behavior.
static assert (!is (typeof(ContainerStorageType!(const(B)))));
// Mutable B is not a problem
static assert (is (ContainerStorageType!(B) == B));

// Arrays can be stored because the entire pointer-length pair is moved as
// a unit.
static assert (is (ContainerStorageType!(const(int[])) == const(int)[]));
static assert (is (ContainerStorageType!(const(int*)) == const(int)*));

Meta