D2 compiler refuses to resolve Item type from IPool implicitly which may be a bug but is easily fixed by introducing explicit alias.
Pool item instance type alias.
Provides safe 'foreach' iteration over all items in the pool.
Provides safe 'foreach' iteration over the busy items in the pool.
Base class for pool 'foreach' iterators. The constructor receives a slice of the items to be iterated over.
Provides safe 'foreach' iteration over the idle items in the pool.
Provides unsafe 'foreach' iteration over all items in the pool.
Provides unsafe 'foreach' iteration over the busy items in the pool.
Provides unsafe 'foreach' iteration over the idle items in the pool.
Provides 'foreach' iteration over items[start .. end]. During iteration all methods of PoolCore may be called except limit_().
Provides 'foreach' iteration over items[start .. end]. During iteration only read-only methods of PoolCore may be called.
Recycles all items in the pool.
Deletes item and sets it to null.
Ensures that the pool contains at least the specified number of items. Useful to pre-allocate a pool of a certain size.
Ensures that the pool contains at least the specified number of items. Useful to pre-allocate a pool of a certain size.
Takes an idle item from the pool or creates a new one if all item are busy or the pool is empty.
Takes an idle item from the pool or creates a new one if all item are busy or the pool is empty.
Gets the object pool index of item.
Takes an idle item from the pool or creates a new one if all item are busy or the pool is empty.
Checks if item is null.
Checks a and b for identity.
Minimizes the number of items in the pool, removing idle items in excess of the specified number. Only idle items will be removed, busy items are not affected. The reset() method (if existing) of any removed items is called before they are deleted.
Obtains the n-th pool item. n must be less than the value returned by length(). Caution: The item must not be recycled; while the item is in use, only opIndex(), opApply(), length() and limit() may be called.
Puts item back to the pool.
Puts item back to the pool.
Resets item.
Sets the object pool index to item.
Sets the limit of number of items in pool or disables limitation for limit = unlimited.
Returns the member of the item union that is used by this instance.
Sets the member of the item union that is used by this instance.
List of items (objects) in pool for safe iteration. items is copied into this array on safe iterator instantiation.
true if a safe iterator instance exists currently, used for assertions to ensure that only a single safe iterator can exist at a time (as it uses the single buffer, iteration_items, above).
Count of unsafe iterator instances which exist currently, used for assertions to ensure that while an unsafe iterator exists the object pool may not be modified.
Pool item union. The list of pool items is an array of Item; the subclass specifies which member is actually used.
May be set to true at any time to limit the number of items in pool to the current number or to false to disable limitation.
List of items (objects) in pool, busy items first
Number of busy items in pool
Returns the number of items in pool.
Returns the number of busy items in pool.
Returns the number of idle items in pool.
Returns the limit of number of items in pool or unlimited if currently unlimited.
Recycles all items in the pool.
Sets the limit of number of items in pool or disables limitation for limit = unlimited. When limiting the pool, any excess idle items are reset and deleted.
Checks if item is currently busy.
Ensures that the pool contains at least the specified number of items. Useful to pre-allocate a pool of a certain size.
Takes an idle item from the pool or creates a new one if all items are busy or the pool is empty.
Obtains the n-th pool item. n must be less than the value returned by length().
Puts item back to the pool.
Sets the object pool index to item.
Gets the object pool index of item.
Resets item.
Deletes item and sets it to null.
Checks a and b for identity.
Checks if item is null.
Removes idle items from the pool. Excess idle items are reset and deleted.
Base class for pools of aggregate types (classes or structs). The items' index (required by the IPool base class) is implemented as a size_t member named 'object_pool_index', which is expected to exist in the type stored in the pool.
Note: certain methods are overridden and have asserts added to them to support the iteration. These asserts are deliberately not placed in an in contract, due to the way in contracts work -- in a class hierarchy only *one* of the class' in contracts must pass, *not* all. In this case, as the base class has no in contract, it would always pass, making any in contracts added here irrelevant.