示例#1
0
        public void Alloc(uint size, Allocator nativeAllocator)
        {
            MB <T> b = new MB <T>();

            b.Set(new T[size]);
            this._realBuffer = b;
            _buffer          = null;
        }
        public void Alloc(uint size)
        {
            MB <T> b = new MB <T>();

            b.Set(new T[size], size);
            buffer          = b;
            this.realBuffer = b;
        }
示例#3
0
        public void Resize(uint newCapacity)
        {
            DBC.Common.Check.Require(newCapacity > 0, "Resize requires a size greater than 0");

            var realBuffer = _realBuffer.ToManagedArray();

            Array.Resize(ref realBuffer, (int)newCapacity);
            MB <T> b = new MB <T>();

            b.Set(realBuffer);
            this._realBuffer = b;
            _buffer          = null;
        }
        public void Resize(uint size)
        {
            DBC.Common.Check.Require(size > 0, "Resize requires a size greater than 0");

            var realBuffer = buffer.ToManagedArray(out _);

            Array.Resize(ref realBuffer, (int)size);
            MB <T> b = new MB <T>();

            b.Set(realBuffer, size);
            buffer          = b;
            this.realBuffer = b;
        }
示例#5
0
        public void Resize(uint newCapacity, bool copyContent = true)
        {
            DBC.Common.Check.Require(newCapacity >= 0, "Resize requires a size greater or equal to 0");

            var realBuffer = _realBuffer.ToManagedArray();

            if (copyContent == true)
            {
                Array.Resize(ref realBuffer, (int)newCapacity);
            }
            else
            {
                realBuffer = new T[newCapacity];
            }

            MB <T> b = new MB <T>();

            b.Set(realBuffer);
            this._realBuffer = b;
            _buffer          = null;
        }