Poco

template < class Key, class Mapped, class HashFunc = Hash < Key >>

class HashMap

Library: Foundation
Package: Hashing
Header: Poco/HashMap.h

Description

This class implements a map using a LinearHashTable.

A HashMap can be used just like a std::map.

Member Summary

Member Functions: begin, clear, count, empty, end, erase, find, insert, operator =, operator [], size, swap

Types Aliases

ConstIterator

using ConstIterator = typename HashTable::ConstIterator;

ConstPointer

using ConstPointer = const Mapped *;

ConstReference

using ConstReference = const Mapped &;

HashTable

using HashTable = LinearHashTable < ValueType, HashType >;

HashType

using HashType = HashMapEntryHash < ValueType, HashFunc >;

Iterator

using Iterator = typename HashTable::Iterator;

KeyType

using KeyType = Key;

MappedType

using MappedType = Mapped;

PairType

using PairType = std::pair < KeyType, MappedType >;

Pointer

using Pointer = Mapped *;

Reference

using Reference = Mapped &;

ValueType

using ValueType = HashMapEntry < Key, Mapped >;

Constructors

HashMap

HashMap() = default;

HashMap inline

HashMap(
    std::size_t initialReserve
);

Creates the HashMap with room for initialReserve entries.

Member Functions

begin inline

ConstIterator begin() const;

begin inline

Iterator begin();

clear inline

void clear();

count inline

std::size_t count(
    const KeyType & key
) const;

empty inline

bool empty() const;

end inline

ConstIterator end() const;

end inline

Iterator end();

erase inline

void erase(
    Iterator it
);

erase inline

void erase(
    const KeyType & key
);

find inline

ConstIterator find(
    const KeyType & key
) const;

find inline

Iterator find(
    const KeyType & key
);

insert inline

std::pair < Iterator, bool > insert(
    const PairType & pair
);

insert inline

std::pair < Iterator, bool > insert(
    const ValueType & value
);

operator = inline

HashMap & operator = (
    const HashMap & map
);

Assigns another HashMap.

operator [] inline

ConstReference operator[] (
    const KeyType & key
) const;

operator [] inline

Reference operator[] (
    const KeyType & key
);

size inline

std::size_t size() const;

swap inline

void swap(
    HashMap & map
) noexcept;

Swaps the HashMap with another one.