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)*));