Add project files.
This commit is contained in:
16
Assets/Cryville/Common/Buffers/SimpleObjectPool.cs
Normal file
16
Assets/Cryville/Common/Buffers/SimpleObjectPool.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
namespace Cryville.Common.Buffers {
|
||||
/// <summary>
|
||||
/// A resource pool that allows reusing instances of type <typeparamref name="T" />, which has a parameterless constructor.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of the objects in the pool.</typeparam>
|
||||
public class SimpleObjectPool<T> : ObjectPool<T> where T : class, new() {
|
||||
/// <summary>
|
||||
/// Creates an instance of the <see cref="SimpleObjectPool{T}" /> class.
|
||||
/// </summary>
|
||||
/// <param name="capacity">The capacity of the pool.</param>
|
||||
public SimpleObjectPool(int capacity) : base(capacity) { }
|
||||
protected override T Construct() {
|
||||
return new T();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user