You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
526 B
21 lines
526 B
using System.Collections.Generic; |
|
using UnityEngine.Pool; |
|
|
|
namespace UnityEditor.Graphing |
|
{ |
|
static class StackPool<T> |
|
{ |
|
// Object pool to avoid allocations. |
|
static readonly ObjectPool<Stack<T>> k_StackPool = new ObjectPool<Stack<T>>(() => new Stack<T>(), null, l => l.Clear()); |
|
|
|
public static Stack<T> Get() |
|
{ |
|
return k_StackPool.Get(); |
|
} |
|
|
|
public static void Release(Stack<T> toRelease) |
|
{ |
|
k_StackPool.Release(toRelease); |
|
} |
|
} |
|
}
|
|
|