No Description
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.

StackPool.cs 526B

123456789101112131415161718192021
  1. using System.Collections.Generic;
  2. using UnityEngine.Pool;
  3. namespace UnityEditor.Graphing
  4. {
  5. static class StackPool<T>
  6. {
  7. // Object pool to avoid allocations.
  8. static readonly ObjectPool<Stack<T>> k_StackPool = new ObjectPool<Stack<T>>(() => new Stack<T>(), null, l => l.Clear());
  9. public static Stack<T> Get()
  10. {
  11. return k_StackPool.Get();
  12. }
  13. public static void Release(Stack<T> toRelease)
  14. {
  15. k_StackPool.Release(toRelease);
  16. }
  17. }
  18. }