// *** IDeeplyCloneable interface implementation *** public SparseVector <T> DeepClone() { SparseVector <T> clone = new SparseVector <T>(); clone.mIdx.Capacity = mIdx.Capacity; clone.mDat.Capacity = mDat.Capacity; for (int i = 0; i < mIdx.Count; i++) { clone.mIdx.Add(mIdx[i]); clone.mDat.Add((T)Utils.Clone(mDat[i], /*deepClone=*/ true)); } return(clone); }
// *** IDeeplyCloneable interface implementation *** public BinaryVector <T> DeepClone() { List <T> vec = new List <T>(m_vec.Count); foreach (T item in m_vec) { vec.Add((T)Utils.Clone(item, /*deep_clone=*/ true)); } BinaryVector <T> clone = new BinaryVector <T>(); clone.m_vec = vec; return(clone); }
// *** IDeeplyCloneable interface implementation *** public Pair <FirstT, SecondT> DeepClone() { return(new Pair <FirstT, SecondT>((FirstT)Utils.Clone(m_first, /*deep_clone=*/ true), (SecondT)Utils.Clone(m_second, /*deep_clone=*/ true))); }