fix(front, back) -> undefined exception; feat(resize)
This commit is contained in:
9
types/List.d.ts
vendored
9
types/List.d.ts
vendored
@ -2,22 +2,17 @@ import { SequenceContainer } from "./containers/Sequence";
|
||||
import { BidirectionalIterator } from "./iterators/Bidirectional";
|
||||
import { Item } from "./iterators/Forward";
|
||||
|
||||
export class List<T> extends SequenceContainer<T> {
|
||||
export class List<T> extends SequenceContainer<T, ListIterator<T>> {
|
||||
/**
|
||||
* empty list
|
||||
*/
|
||||
constructor();
|
||||
/**
|
||||
* list with single element
|
||||
* @param value which will be inserted
|
||||
*/
|
||||
constructor(value: T);
|
||||
/**
|
||||
* list with n similar elements
|
||||
* @param value which will be inserted
|
||||
* @param n count of how many values will be inserted
|
||||
*/
|
||||
constructor(value: T, n: number);
|
||||
constructor(value: T, n?: number);
|
||||
/**
|
||||
* copies range of another list
|
||||
* @param begin of another SequenceContainer<T>
|
||||
|
||||
41
types/containers/Sequence.d.ts
vendored
41
types/containers/Sequence.d.ts
vendored
@ -1,21 +1,23 @@
|
||||
import { BidirectionalIterator } from "../iterators/Bidirectional";
|
||||
import { ForwardIterator } from "../iterators/Forward";
|
||||
|
||||
export class SequenceContainer<T> {
|
||||
move(rhs: SequenceContainer<T>): this;
|
||||
export class SequenceContainer<T, It extends ForwardIterator<T>> {
|
||||
move(rhs: SequenceContainer<T, It>): this;
|
||||
size(): number;
|
||||
begin(): BidirectionalIterator<T>;
|
||||
end(): BidirectionalIterator<T>;
|
||||
begin(): It;
|
||||
end(): It;
|
||||
|
||||
clone(): this;
|
||||
copy(rhs: SequenceContainer<T>): this;
|
||||
copy(rhs: SequenceContainer<T, It>): this;
|
||||
empty(): boolean;
|
||||
/**
|
||||
* @returns direct access to front item's value
|
||||
* @throws Error if size == 0
|
||||
*/
|
||||
get front(): T;
|
||||
set front(value: T);
|
||||
/**
|
||||
* @returns direct access to back item's value
|
||||
* @throws Error if size == 0
|
||||
*/
|
||||
get back(): T;
|
||||
set back(value: T);
|
||||
@ -26,7 +28,7 @@ export class SequenceContainer<T> {
|
||||
* @param end of another SequenceContainer<T>
|
||||
* @returns iterator right after end iterator
|
||||
*/
|
||||
insert(dest: BidirectionalIterator<T>, begin: BidirectionalIterator<T>, end: BidirectionalIterator<T>): BidirectionalIterator<T>;
|
||||
insert(dest: It, begin: It, end: It): It;
|
||||
/**
|
||||
* inserts [begin, end) at dest
|
||||
* @param dest where to insert
|
||||
@ -34,52 +36,39 @@ export class SequenceContainer<T> {
|
||||
* @param n count of how many values will be inserted
|
||||
* @returns iterator right after last inserted value
|
||||
*/
|
||||
insert(dest: BidirectionalIterator<T>, value: T, n: number): BidirectionalIterator<T>;
|
||||
/**
|
||||
* inserts [begin, end) at dest
|
||||
* @param dest where to insert
|
||||
* @param value which will be inserted
|
||||
* @returns iterator right after inserted value
|
||||
*/
|
||||
insert(dest: BidirectionalIterator<T>, value: T): BidirectionalIterator<T>;
|
||||
insert(dest: It, value: T, n?: number): It;
|
||||
/**
|
||||
* same as list.clear(); list.insert(list.begin(), ...)
|
||||
* @param begin of another SequenceContainer<T>
|
||||
* @param end of another SequenceContainer<T>
|
||||
* @returns end iterator
|
||||
*/
|
||||
assign(begin: BidirectionalIterator<T>, end: BidirectionalIterator<T>): BidirectionalIterator<T>;
|
||||
assign(begin: It, end: It): It;
|
||||
/**
|
||||
* same as list.clear(); list.insert(list.begin(), ...)
|
||||
* @param value which will be inserted
|
||||
* @param n count of how many values will be inserted
|
||||
* @returns iterator right after last inserted value
|
||||
*/
|
||||
assign(value: T, n: number): BidirectionalIterator<T>;
|
||||
/**
|
||||
* same as list.clear(); list.insert(list.begin(), ...)
|
||||
* @param value which will be inserted
|
||||
* @returns iterator right after inserted value
|
||||
*/
|
||||
assign(value: T): BidirectionalIterator<T>;
|
||||
assign(value: T, n?: number): It;
|
||||
/**
|
||||
* erases [begin, end)
|
||||
* @param begin of erased range
|
||||
* @param end of erased range
|
||||
* @returns iterator right after erased range
|
||||
*/
|
||||
erase(begin: BidirectionalIterator<T>, end: BidirectionalIterator<T>): BidirectionalIterator<T>;
|
||||
erase(begin: It, end: It): It;
|
||||
/**
|
||||
* erases single item
|
||||
* @param begin which points to erased item
|
||||
* @returns iterator right after erased value
|
||||
*/
|
||||
erase(begin: BidirectionalIterator<T>): BidirectionalIterator<T>;
|
||||
erase(item: It): It;
|
||||
/**
|
||||
* same as list.erase(list.begin(), list.end())
|
||||
* @returns end iterator
|
||||
*/
|
||||
clear(): BidirectionalIterator<T>;
|
||||
clear(): It;
|
||||
pushFront(value: T): void;
|
||||
pushBack(value: T): void;
|
||||
popFront(): void;
|
||||
|
||||
Reference in New Issue
Block a user