示例#1
0
        public static void Copy <T>(HashSetCopyable <T> fromArr, ref HashSetCopyable <T> arr) where T : struct
        {
            if (fromArr == null)
            {
                if (arr != null)
                {
                    PoolHashSetCopyable <T> .Recycle(ref arr);
                }

                arr = null;
                return;
            }

            if (arr == null)
            {
                arr = PoolHashSetCopyable <T> .Spawn(fromArr.Count);
            }

            arr.CopyFrom(fromArr);
        }
示例#2
0
        public static void Copy <T, TCopy>(HashSetCopyable <T> fromArr, ref HashSetCopyable <T> arr, TCopy copy) where T : struct where TCopy : IArrayElementCopy <T>
        {
            if (fromArr == null)
            {
                if (arr != null)
                {
                    arr.Clear(copy);
                    PoolHashSetCopyable <T> .Recycle(ref arr);
                }

                arr = null;
                return;
            }

            if (arr == null)
            {
                arr = PoolHashSetCopyable <T> .Spawn();
            }

            arr.CopyFrom(fromArr, copy);
        }