Report a bug
		
				If you spot a problem with this page, click here to create a Bugzilla 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 using
			a local clone.
		
	std.experimental.allocator.common
Utility and ancillary artifacts of std.experimental.allocator. This module
shouldn't be used directly; its functionality will be migrated into more
appropriate parts of std.
Authors: 
Andrei Alexandrescu, Timon Gehr (Ternary)
- enum autoisAllocator(A);
- Is true iff A is an allocator.Examples:import std.experimental.allocator.building_blocks.null_allocator : NullAllocator; import std.experimental.allocator.mallocator : Mallocator; import std.experimental.allocator.gc_allocator : GCAllocator; import std.experimental.allocator.mmap_allocator : MmapAllocator; static assert(isAllocator!NullAllocator); static assert(isAllocator!Mallocator); static assert(isAllocator!GCAllocator); static assert(isAllocator!MmapAllocator); static assert(!isAllocator!int); 
- templatestateSize(T)
- Returns the size in bytes of the state that needs to be allocated to hold an object of type T.stateSize!T is zero for structs that are not nested and have no nonstatic member variables.
- enum autohasStaticallyKnownAlignment(Allocator);
- Returns true if the Allocator has the alignment known at compile time; otherwise it returns false.
- enum ulongchooseAtRuntime;
- chooseAtRuntimeis a compile-time constant of type size_t that several parameterized structures in this module recognize to mean deferral to runtime of the exact value. For example, BitmappedBlock!(Allocator, 4096) (described in detail below) defines a block allocator with block size of 4096 bytes, whereas BitmappedBlock!(Allocator, chooseAtRuntime) defines a block allocator that has a field storing the block size, initialized by the user.
- enum ulongunbounded;
- unboundedis a compile-time constant of type size_t that several parameterized structures in this module recognize to mean "infinite" bounds for the parameter. For example, Freelist (described in detail below) accepts a maxNodes parameter limiting the number of freelist items. If- unboundedis passed for maxNodes, then there is no limit and no checking for the number of nodes.
- enum uintplatformAlignment;
- The alignment that is guaranteed to accommodate any D object allocation on the current platform.
- size_tgoodAllocSize(A)(auto ref Aa, size_tn);
- The default good size allocation is deduced asnrounded up to the allocator's alignment.
- boolreallocate(Allocator)(ref Allocatora, ref void[]b, size_ts);
- The defaultreallocatefunction first attempts to use expand. If Allocator.expand is not defined or returns false,reallocateallocates a new block of memory of appropriate size and copies data from the old block to the new block. Finally, if Allocator defines deallocate, reallocate uses it to free the old memory block.reallocatedoes not attempt to use Allocator.reallocateeven if defined. This is deliberate so allocators may use it internally within their own implementation ofreallocate.
- boolalignedReallocate(Allocator)(ref Allocatoralloc, ref void[]b, size_ts, uinta)
 if (hasMember!(Allocator, "alignedAllocate"));
- The defaultalignedReallocatefunction first attempts to use expand. If Allocator.expand is not defined or returns false, alignedReallocate allocates a new block of memory of appropriate size and copies data from the old block to the new block. Finally, if Allocator defines deallocate,alignedReallocateuses it to free the old memory block.alignedReallocatedoes not attempt to use Allocator.reallocate even if defined. This is deliberate so allocators may use it internally within their own implementation of reallocate.
- stringforwardToMember(stringmember, string[]funs...);
- Forwards each of the methods infuns(if defined) tomember.
Copyright © 1999-2024 by the D Language Foundation | Page generated by
Ddoc on (no date time)