Options
All
  • Public
  • Public/Protected
  • All
Menu

Class UniqueMap<Key, T, Source, Iterator, Reverse>

Basic map container blocking duplicated key.

author

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

Type parameters

  • Key

    Key type

  • T

    Mapped type

  • Source: UniqueMap<Key, T, Source, Iterator, Reverse>

    Derived type extending this UniqueMap

  • Iterator: Iterator<Key, T, Source, Iterator, Reverse>

  • Reverse: ReverseIterator<Key, T, Source, Iterator, Reverse>

Hierarchy

Implements

Index

Type aliases

Static InsertRet

InsertRet<Key, T, Unique, SourceT, IteratorT, Reverse>: Unique extends true ? Pair<IteratorT, boolean> : IteratorT

Return type of {@link MapContainer.insert}

Type parameters

  • Key

  • T

  • Unique: boolean

  • SourceT: MapContainer<Key, T, Unique, SourceT, IteratorT, Reverse>

  • IteratorT: Iterator<Key, T, Unique, SourceT, IteratorT, Reverse>

    Iterator type

  • Reverse: ReverseIterator<Key, T, Unique, SourceT, IteratorT, Reverse>

Static Iterator

Iterator<Key, T, Unique, SourceT, IteratorT, ReverseT, Key, T, SourceT, IteratorT, ReverseT>: Iterator<Key, T, true, SourceT, IteratorT, ReverseT>

Iterator of MapContainer Iterator of UniqueMap

author

Jenogho Nam http://samchon.org

author

Jenogho Nam http://samchon.org

Type parameters

  • Key

  • T

  • Unique: boolean

  • SourceT: MapContainer<Key, T, Unique, SourceT, IteratorT, ReverseT>

  • IteratorT: Iterator<Key, T, Unique, SourceT, IteratorT, ReverseT>

  • ReverseT: ReverseIterator<Key, T, Unique, SourceT, IteratorT, ReverseT>

    Reverse iterator type

  • Key

  • T

  • SourceT: UniqueMap<Key, T, SourceT, IteratorT, ReverseT>

  • IteratorT: Iterator<Key, T, SourceT, IteratorT, ReverseT>

  • ReverseT: ReverseIterator<Key, T, SourceT, IteratorT, ReverseT>

Static ReverseIterator

ReverseIterator<Key, T, Unique, SourceT, IteratorT, ReverseT, Key, T, SourceT, IteratorT, ReverseT>: ReverseIterator<Key, T, true, SourceT, IteratorT, ReverseT>

Reverse iterator of MapContainer Reverse iterator of UniqueMap

author

Jenogho Nam http://samchon.org

author

Jenogho Nam http://samchon.org

Type parameters

  • Key

  • T

  • Unique: boolean

  • SourceT: MapContainer<Key, T, Unique, SourceT, IteratorT, ReverseT>

  • IteratorT: Iterator<Key, T, Unique, SourceT, IteratorT, ReverseT>

  • ReverseT: ReverseIterator<Key, T, Unique, SourceT, IteratorT, ReverseT>

  • Key

  • T

  • SourceT: UniqueMap<Key, T, SourceT, IteratorT, ReverseT>

  • IteratorT: Iterator<Key, T, SourceT, IteratorT, ReverseT>

  • ReverseT: ReverseIterator<Key, T, SourceT, IteratorT, ReverseT>

Constructors

Protected constructor

  • new UniqueMap(factory: (thisArg: Source) => ILinearContainerBase<Entry<Key, T>, Source, Iterator, Reverse>): UniqueMap
  • Default Constructor.

    Parameters

    • factory: (thisArg: Source) => ILinearContainerBase<Entry<Key, T>, Source, Iterator, Reverse>
        • (thisArg: Source): ILinearContainerBase<Entry<Key, T>, Source, Iterator, Reverse>
        • Parameters

          • thisArg: Source

          Returns ILinearContainerBase<Entry<Key, T>, Source, Iterator, Reverse>

    Returns UniqueMap

Methods

[Symbol.iterator]

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

assign

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

begin

  • begin(): Iterator

clear

  • clear(): void

count

  • count(key: Key): number

Abstract emplace

  • emplace(key: Key, value: T): Pair<Iterator, boolean>
  • Construct and insert element.

    Parameters

    • key: Key

      Key to be mapped or search for.

    • value: T

      Value to emplace.

    Returns Pair<Iterator, 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.

Abstract emplace_hint

  • emplace_hint(hint: Iterator, key: Key, val: T): Iterator
  • Construct and insert element with hint.

    Parameters

    • hint: Iterator

      Hint for the position where the element can be inserted.

    • key: Key

      Key of the new element.

    • val: T

      Value of the new element.

    Returns Iterator

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

empty

  • empty(): boolean

end

  • end(): Iterator

erase

  • erase(key: Key): number
  • erase(it: Iterator): Iterator
  • erase(begin: Iterator, end: Iterator): Iterator

extract

  • extract(key: Key): Entry<Key, T>
  • extract(pos: Iterator): Iterator
  • Extract an element by key.

    Parameters

    • key: Key

      Key to search for.

    Returns Entry<Key, T>

    The extracted element.

  • Extract an element by iterator.

    Parameters

    • pos: Iterator

      The iterator to the element for extraction.

    Returns Iterator

    Iterator following the pos, strained by the extraction.

Abstract find

  • find(key: Key): Iterator

get

  • get(key: Key): T

has

  • has(key: Key): boolean

insert

  • insert(pair: IPair<Key, T>): Pair<Iterator, boolean>
  • insert(hint: Iterator, pair: IPair<Key, T>): Iterator
  • 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<Iterator, 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: Iterator

      Hint for the position where the element can be inserted.

    • pair: IPair<Key, T>

      A tuple to be referenced for the insert.

    Returns Iterator

    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<Iterator, boolean>
  • insert_or_assign(hint: Iterator, key: Key, value: T): Iterator
  • Insert or assign an element.

    Parameters

    • key: Key

      Key to be mapped or search for.

    • value: T

      Value to insert or assign.

    Returns Pair<Iterator, 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: Iterator

      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 Iterator

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

merge

  • merge(source: Source): void

push

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

rbegin

  • rbegin(): Reverse

rend

  • rend(): Reverse

set

  • set(key: Key, val: T): void
  • Set a value with key.

    Parameters

    • key: Key

      Key to be mapped or search for.

    • val: T

      Value to insert or assign.

    Returns void

size

  • size(): number

Abstract swap

  • swap(obj: Source): void

toJSON

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

Generated using TypeDoc