Options
All
  • Public
  • Public/Protected
  • All
Menu

Class FlatMap<Key, T>

Unique-key Map based on sorted array.

author

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

Type parameters

  • Key

  • T

Hierarchy

  • UniqueTreeMap<Key, T, FlatMap<Key, T>, FlatMap.Iterator<Key, T>, FlatMap.ReverseIterator<Key, T>>
    • FlatMap

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 FlatMap

  • Initializer Constructor.

    Parameters

    • items: IPair<Key, T>[]

      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 FlatMap

  • Copy Constructor.

    Parameters

    • obj: FlatMap<Key, T>

      Object to copy.

    Returns FlatMap

  • Range Constructor.

    Parameters

    • first: Readonly<IForwardIterator<IPair<Key, T>>>

      Input iterator of the first position.

    • last: Readonly<IForwardIterator<IPair<Key, T>>>

      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 FlatMap

Methods

[Symbol.iterator]

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

assign

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

begin

  • begin(): FlatMap.Iterator<Key, T>

clear

  • clear(): void

count

  • count(key: Key): number

emplace

  • emplace(key: Key, val: T): Pair<FlatMap.Iterator<Key, T>, boolean>

emplace_hint

  • emplace_hint(hint: FlatMap.Iterator<Key, T>, key: Key, val: T): FlatMap.Iterator<Key, T>

empty

  • empty(): boolean

end

  • end(): FlatMap.Iterator<Key, T>

equal_range

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

erase

  • erase(key: Key): number
  • erase(it: FlatMap.Iterator<Key, T>): FlatMap.Iterator<Key, T>
  • erase(begin: FlatMap.Iterator<Key, T>, end: FlatMap.Iterator<Key, T>): FlatMap.Iterator<Key, T>

extract

  • extract(key: Key): Entry<Key, T>
  • extract(pos: FlatMap.Iterator<Key, T>): FlatMap.Iterator<Key, T>

find

  • find(key: Key): FlatMap.Iterator<Key, T>

get

  • get(key: Key): T

has

  • has(key: Key): boolean

insert

  • insert(pair: IPair<Key, T>): Pair<FlatMap.Iterator<Key, T>, boolean>
  • insert(hint: FlatMap.Iterator<Key, T>, pair: IPair<Key, T>): FlatMap.Iterator<Key, T>
  • insert<InputIterator>(first: InputIterator, last: InputIterator): void
  • Insert an element.

    Parameters

    • pair: IPair<Key, T>

      A tuple to be referenced for the insert.

    Returns Pair<FlatMap.Iterator<Key, T>, boolean>

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

  • Insert an element with hint.

    Parameters

    • hint: FlatMap.Iterator<Key, T>

      Hint for the position where the element can be inserted.

    • pair: IPair<Key, T>

      A tuple to be referenced for the insert.

    Returns FlatMap.Iterator<Key, T>

    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

insert_or_assign

  • insert_or_assign(key: Key, value: T): Pair<FlatMap.Iterator<Key, T>, boolean>
  • insert_or_assign(hint: FlatMap.Iterator<Key, T>, key: Key, value: T): FlatMap.Iterator<Key, T>
  • Insert or assign an element.

    Parameters

    • key: Key

      Key to be mapped or search for.

    • value: T

      Value to insert or assign.

    Returns Pair<FlatMap.Iterator<Key, T>, boolean>

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

  • Insert or assign an element with hint.

    Parameters

    • hint: FlatMap.Iterator<Key, T>

      Hint for the position where the element can be inserted.

    • key: Key

      Key to be mapped or search for.

    • value: T

      Value to insert or assign.

    Returns FlatMap.Iterator<Key, T>

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

key_comp

  • key_comp(): Comparator<Key>

lower_bound

  • lower_bound(key: Key): FlatMap.Iterator<Key, T>

merge

  • merge(source: FlatMap<Key, T>): void

nth

  • nth(index: number): FlatMap.Iterator<Key, T>

push

  • push(...items: IPair<Key, T>[]): number

rbegin

  • rbegin(): FlatMap.ReverseIterator<Key, T>

rend

  • rend(): FlatMap.ReverseIterator<Key, T>

set

  • set(key: Key, val: T): void

size

  • size(): number

swap

toJSON

  • toJSON(): Array<Entry<Key, T>>

upper_bound

  • upper_bound(key: Key): FlatMap.Iterator<Key, T>

value_comp

  • value_comp(): Comparator<IPair<Key, T>>

Generated using TypeDoc