refCounted

Constructs a new object of type T and wraps it in a $(D_PSYMBOL RefCounted) using args as the parameter list for the constructor of T.

This function is more efficient than the using of $(D_PSYMBOL RefCounted) directly, since it allocates only ones (the internal storage and the object).

  1. RefCounted!T refCounted(Allocator allocator, A args)
    refCounted
    (
    T
    A...
    )
    (,
    auto ref A args
    )
    if (
    !is(T == interface) &&
    &&
    &&
    )
  2. RefCounted!T refCounted(Allocator allocator, size_t size)

Parameters

T

Type of the constructed object.

A

Types of the arguments to the constructor of T.

allocator Allocator

Allocator.

args A

Constructor arguments of T.

Return Value

Type: RefCounted!T

Newly created $(D_PSYMBOL RefCounted!T).

Precondition: allocator !is null

Meta