RefCounted.refCountedPayload

Returns a reference to the payload. If (autoInit == RefCountedAutoInitialize.yes), calls refCountedStore.ensureInitialized. Otherwise, just issues assert(refCountedStore.isInitialized). Used with alias refCountedPayload this;, so callers can just use the RefCounted object as a T.

The first overload exists only if autoInit == RefCountedAutoInitialize.yes. So if autoInit == RefCountedAutoInitialize.no or called for a constant or immutable object, then refCountedPayload will also be qualified as safe and nothrow (but will still assert if not initialized).

  1. T refCountedPayload [@property getter]
  2. inout(T) refCountedPayload [@property getter]
    struct RefCounted(T, RefCountedAutoInitialize autoInit = RefCountedAutoInitialize.yes)
    version(StdDdoc)
    @property nothrow @safe pure @nogc ref inout return
    inout(T)
    refCountedPayload
    ()
    if (
    !is(T == class) &&
    !(is(T == interface))
    )

Meta

Suggestion Box / Bug Report