rebindable

This function simply returns the Rebindable object passed in. It's useful in generic programming cases when a given object may be either a regular class or a Rebindable.

  1. Rebindable!T rebindable(T obj)
  2. Rebindable!T rebindable(Rebindable!T obj)
    rebindable
    (
    T
    )

Parameters

obj Rebindable!T

An instance of Rebindable!T.

Return Value

Type: Rebindable!T

obj without any modification.

Examples

class C
{
    int payload;
    this(int p) { payload = p; }
}
const c = new C(1);

auto c2 = c.rebindable;
assert(c2.payload == 1);
// passing Rebindable to rebindable
c2 = c2.rebindable;
assert(c2.payload == 1);

Meta

Suggestion Box / Bug Report