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

ConstIterator

typedef typename HashTable::ConstIterator ConstIterator;

ConstPointer

typedef const Mapped * ConstPointer;

ConstReference

typedef const Mapped & ConstReference;

HashTable

typedef LinearHashTable < ValueType, HashType > HashTable;

HashType

typedef HashMapEntryHash < ValueType, HashFunc > HashType;

Iterator

typedef typename HashTable::Iterator Iterator;

KeyType

typedef Key KeyType;

MappedType

typedef Mapped MappedType;

PairType

typedef std::pair < KeyType, MappedType > PairType;

Pointer

typedef Mapped * Pointer;

Reference

typedef Mapped & Reference;

ValueType

typedef HashMapEntry < Key, Mapped > ValueType;

Constructors

HashMap inline

HashMap();

Creates an empty HashMap.

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.