feat(Vector)

This commit is contained in:
2025-07-23 10:36:50 +03:00
parent 83c491ff6f
commit aca4539ce4
21 changed files with 1103 additions and 1533 deletions

View File

@ -1,6 +1,6 @@
import { ForwardIterator } from "./Forward";
export class BidirectionalIterator<T> extends ForwardIterator<T> {
export interface BidirectionalIterator<T> extends ForwardIterator<T> {
/**
* decrements iterator, it doesn't make copy
* @returns {this}

View File

@ -1,10 +1,12 @@
export class Item<T> {
export interface Item<T> {
value: T
}
export class ForwardIterator<T> {
export interface ForwardIterator<T> {
clone(): ForwardIterator<T>;
copy(rhs: ForwardIterator<T>): this;
get value(): T;
set value(value: T);
deref(): Item<T>;
eq(rhs: ForwardIterator<T>): boolean;
/**
@ -18,7 +20,5 @@ export class ForwardIterator<T> {
* @returns {this}
*/
move(rhs: ForwardIterator<T>): this;
get value(): T;
set value(value: T);
neq(rhs: ForwardIterator<T>): boolean;
}

9
types/iterators/RandomAccess.d.ts vendored Normal file
View File

@ -0,0 +1,9 @@
import { BidirectionalIterator } from "./Bidirectional";
export interface RandomAccessIterator<T> extends BidirectionalIterator<T> {
sub(offset: number): this;
add(offset: number): this;
cmp(rhs: RandomAccessIterator<T>): number;
get(idx: number): T;
set(idx: number, value: T): T;
}