View source code
Display the source code in std/experimental/allocator/package.d from which thispage was generated on github.
Report a bug
If you spot a problem with this page, click here to create aBugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page.Requires a signed-in GitHub account. This works well for small changes.If you'd like to make larger changes you may want to consider usinglocal clone.

Function std.experimental.allocator.sharedAllocatorObject

Returns a dynamically-typed CSharedAllocator built around a given statically- typed allocator a of type A. Passing a pointer to the allocator creates a dynamic allocator around the allocator pointed to by the pointer, without attempting to copy or move it. Passing the allocator by value or reference behaves as follows.

RCISharedAllocator sharedAllocatorObject(A)(
  auto ref A a
) nothrow
if (!isPointer!A);

RCISharedAllocator sharedAllocatorObject(A)(
  A* pa
);

  • If A has no state, the resulting object is allocated in static shared storage.
  • If A has state and is copyable, the result will move the supplied allocator A a within. The result itself is allocated in its own statically-typed allocator.
  • If A has state and is not copyable, the result will move the passed-in argument into the result. The result itself is allocated in its own statically-typed allocator.

Authors

Andrei Alexandrescu

License

Boost License 1.0.