Initial Commit
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
using System.Collections.Generic;
|
||||
using ModestTree;
|
||||
|
||||
namespace Zenject
|
||||
{
|
||||
public class HashSetPool<T> : StaticMemoryPool<HashSet<T>>
|
||||
{
|
||||
static HashSetPool<T> _instance = new HashSetPool<T>();
|
||||
|
||||
public HashSetPool()
|
||||
{
|
||||
OnSpawnMethod = OnSpawned;
|
||||
OnDespawnedMethod = OnDespawned;
|
||||
}
|
||||
|
||||
public static HashSetPool<T> Instance
|
||||
{
|
||||
get { return _instance; }
|
||||
}
|
||||
|
||||
static void OnSpawned(HashSet<T> items)
|
||||
{
|
||||
Assert.That(items.IsEmpty());
|
||||
}
|
||||
|
||||
static void OnDespawned(HashSet<T> items)
|
||||
{
|
||||
items.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user