Singularity/Library/PackageCache/com.unity.shadergraph@12.1.11/Editor/Data/Util/StackPool.cs

22 lines
526 B
C#
Raw Normal View History

2024-05-06 14:45:45 -04:00
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);
}
}
}