internal static void Internal_CopySelf <T>(this IRawContainer <T> self, int sidx, int didx, int count) where T : unmanaged { if (sidx == didx) { return; } RawIterator <T> ss_iter = self.begin(); RawIterator <T> ds_iter = ss_iter; if (sidx < didx) { int tmp_i = count - 1; ss_iter += sidx + tmp_i; ds_iter += didx + tmp_i; for (; --count >= 0; ds_iter--, ss_iter--) { *ds_iter.Value = *ss_iter.Value; } } else { ss_iter += sidx; ds_iter += didx; for (; --count >= 0; ds_iter++, ss_iter++) { *ds_iter.Value = *ss_iter.Value; } } }
public static void CopyTo <T>(this IRawContainer <T> source, int src_start_index, IRawContainer <T> dest, int dst_start_index, int count) where T : unmanaged { if (source.size() - src_start_index < count || dest.size() - dst_start_index < count) { throw new InvalidOperationException("can't copy to dest. reason: 'overflow'"); } else if (count <= 0) { return; } else if (source == dest) { Internal_CopySelf(source, src_start_index, dst_start_index, count); return; } RawIterator <T> src_iter = source.begin() + src_start_index; RawIterator <T> dst_iter = dest.begin() + dst_start_index; for (; --count >= 0; dst_iter++, src_iter++) { *dst_iter.Value = *src_iter.Value; } }
internal static void Internal_Earse_Single <T>(RawIterator <T> position, RawIterator <T> arrayEnd) where T : unmanaged { RawIterator <T> copy_src = position + 1; for (; copy_src != arrayEnd; position++, copy_src++) { *position.Value = *copy_src.Value; } *position.Value = default; }
public static RawIterator <T> Find <T>(this IRawContainer <T> source, T item, IEqualityComparer <T> comparer) where T : unmanaged { RawIterator <T> cur = source.begin(); RawIterator <T> end = source.end(); for (; cur != end; cur++) { if (comparer.Equals(*cur.Value, item)) { return(cur); } } return(default);
internal static int Internal_Earse <T>(RawIterator <T> first, RawIterator <T> last, RawIterator <T> arrayEnd) where T : unmanaged { RawIterator <T> copy_src = last + 1, copy_dst = first; for (; copy_src != arrayEnd; copy_dst++, copy_src++) { *copy_dst.Value = *copy_src.Value; } T def00 = default; int earse_cnt = 0; for (; copy_dst != arrayEnd; copy_dst++, earse_cnt++) { *copy_dst.Value = def00; } return(earse_cnt); }
public void Reset() => current = start;
public RawIteratorEnumerator(IRawContainer <T> container) { current = start = container.begin(); end = container.end(); }