Options
All
  • Public
  • Public/Protected
  • All
Menu

Class FlatSet<Key>

Unique-key Set based on sorted array.

author

Jeongho Nam - https://github.com/samchon

Type parameters

  • Key

Hierarchy

Implements

Index

Constructors

constructor

  • Default Constructor.

    Parameters

    • Optional comp: Comparator<Key>

      A binary function predicates x element would be placed before y. When returns true, then x precedes y. Note that, because equality is predicated by !comp(x, y) && !comp(y, x), the function must not cover the equality like <= or >=. It must exclude the equality like < or >. Default is less.

    Returns FlatSet

  • Initializer Constructor.

    Parameters

    • items: Key[]

      Items to assign.

    • Optional comp: Comparator<Key>

      A binary function predicates x element would be placed before y. When returns true, then x precedes y. Note that, because equality is predicated by !comp(x, y) && !comp(y, x), the function must not cover the equality like <= or >=. It must exclude the equality like < or >. Default is less.

    Returns FlatSet

  • Copy Constructor.

    Parameters

    • obj: FlatSet<Key>

      Object to copy.

    Returns FlatSet

  • Range Constructor.

    Parameters

    • first: Readonly<IForwardIterator<Key>>

      Input iterator of the first position.

    • last: Readonly<IForwardIterator<Key>>

      Input iterator of the last position.

    • Optional comp: Comparator<Key>

      A binary function predicates x element would be placed before y. When returns true, then x precedes y. Note that, because equality is predicated by !comp(x, y) && !comp(y, x), the function must not cover the equality like <= or >=. It must exclude the equality like < or >. Default is less.

    Returns FlatSet

Methods

[Symbol.iterator]

  • [Symbol.iterator](): IterableIterator<Key>

assign

  • assign<InputIterator>(first: InputIterator, last: InputIterator): void

begin

  • begin(): FlatSet.Iterator<Key>

clear

  • clear(): void

count

  • count(key: Key): number

empty

  • empty(): boolean

end

  • end(): FlatSet.Iterator<Key>

equal_range

  • equal_range(key: Key): Pair<FlatSet.Iterator<Key>, FlatSet.Iterator<Key>>

erase

  • erase(key: Key): number
  • erase(pos: FlatSet.Iterator<Key>): FlatSet.Iterator<Key>
  • erase(first: FlatSet.Iterator<Key>, last: FlatSet.Iterator<Key>): FlatSet.Iterator<Key>

extract

  • extract(key: Key): Key
  • extract(it: FlatSet.Iterator<Key>): FlatSet.Iterator<Key>

find

  • find(key: Key): FlatSet.Iterator<Key>

has

  • has(key: Key): boolean

insert

  • insert(key: Key): Pair<FlatSet.Iterator<Key>, boolean>
  • insert(hint: FlatSet.Iterator<Key>, key: Key): FlatSet.Iterator<Key>
  • insert<InputIterator>(first: InputIterator, last: InputIterator): void
  • Insert an element.

    Parameters

    • key: Key

      Key to insert.

    Returns Pair<FlatSet.Iterator<Key>, boolean>

    Pair of an iterator to the newly inserted element and true, if the specified key doesn't exist, otherwise Pair of iterator to ordinary element and false.

  • Insert an element with hint.

    Parameters

    • hint: FlatSet.Iterator<Key>

      Hint for the position where the element can be inserted.

    • key: Key

    Returns FlatSet.Iterator<Key>

    An iterator to the newly inserted element, if the specified key doesn't exist, otherwise an iterator to the ordinary element.

  • Insert range elements.

    Type parameters

    Parameters

    • first: InputIterator

      Input iterator of the first position.

    • last: InputIterator

      Input iteartor of the last position.

    Returns void

key_comp

  • key_comp(): Comparator<Key>

lower_bound

  • lower_bound(key: Key): FlatSet.Iterator<Key>

merge

  • merge(source: FlatSet<Key>): void

nth

  • nth(index: number): FlatSet.Iterator<Key>

push

  • push(...items: Key[]): number

rbegin

  • rbegin(): FlatSet.ReverseIterator<Key>

rend

  • rend(): FlatSet.ReverseIterator<Key>

size

  • size(): number

swap

toJSON

  • toJSON(): Array<Key>

upper_bound

  • upper_bound(key: Key): FlatSet.Iterator<Key>

value_comp

  • value_comp(): Comparator<Key>

Generated using TypeDoc