BitsetsNET.RoaringArray.Clone C# (CSharp) Method

Clone() public method

Creates a deep copy of this roaring array
public Clone ( ) : RoaringArray
return RoaringArray
        public RoaringArray Clone()
        {
            RoaringArray sa = new RoaringArray();

            sa.keys = new ushort[this.keys.Length];
            this.keys.CopyTo(sa.keys, 0);

            sa.values = new Container[this.values.Length];
            this.values.CopyTo(sa.values, 0);

            for (int k = 0; k < this.Size; ++k)
            {
                sa.values[k] = sa.values[k].Clone();
            }

            sa.Size = this.Size;

            return sa;
        }

Usage Example

Example #1
0
        /// <summary>
        /// Create a new bitset that is a deep copy of this one.
        /// </summary>
        /// <returns>The cloned bitset</returns>
        public IBitset Clone()
        {
            RoaringBitset x = new RoaringBitset();

            x.containers = containers.Clone();
            return(x);
        }