Array.isUnique

Check whether there are no more references to this array instance.

struct Array(T)
@nogc nothrow pure @safe
bool
isUnique
(
this _
)
()

Return Value

Type: bool

true if this is the only reference to this array instance; false otherwise.

Complexity: O(1).

Examples

auto a = Array!int(24, 42);
assert(a.isUnique);
{
    auto a2 = a;
    assert(!a.isUnique);
    a2.front = 0;
    assert(a.front == 0);
} // a2 goes out of scope
assert(a.isUnique);

Meta