template class Poco::ListMap

Overview

This class implements a multimap in terms of a sequential container. Moreā€¦

#include <ListMap.h>

template <
    class Key,
    class Mapped,
    class Container = std::list<std::pair<Key, Mapped> >,
    bool CaseSensitive = false
    >
class ListMap
{
public:
    // typedefs

    typedef Key KeyType;
    typedef Mapped MappedType;
    typedef Mapped& Reference;
    typedef const Mapped& ConstReference;
    typedef Mapped* Pointer;
    typedef const Mapped* ConstPointer;
    typedef Container::value_type ValueType;
    typedef Container::size_type SizeType;
    typedef Container::iterator Iterator;
    typedef Container::const_iterator ConstIterator;

    // construction

    ListMap();
    ListMap(std::size_t initialReserve);

    // methods

    ListMap&
    operator=(const ListMap& map);

    void
    swap(ListMap& map);

    ConstIterator
    begin() const;

    ConstIterator
    end() const;

    Iterator
    begin();

    Iterator
    end();

    ConstIterator
    find(const KeyType& key) const;

    Iterator
    find(const KeyType& key);

    Iterator
    insert(const ValueType& val);

    void
    erase(Iterator it);

    SizeType
    erase(const KeyType& key);

    void
    clear();

    std::size_t
    size() const;

    bool
    empty() const;

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

    Reference
    operator[](const KeyType& key);
};

Detailed Documentation

This class implements a multimap in terms of a sequential container.

The use for this type of associative container is wherever automatic ordering of elements is not desirable. Naturally, this container will have inferior data retrieval performance and it is not recommended for use with large datasets. The main purpose within POCO is for Internet messages (email message, http headers etc), to prevent automatic header entry reordering.

Construction

ListMap()

Creates an empty ListMap.

Methods

ListMap&
operator=(const ListMap& map)

Assigns another ListMap.

void
swap(ListMap& map)

Swaps the ListMap with another one.

ConstIterator
begin() const

Returns the beginning of the map.

ConstIterator
end() const

Returns the end of the map.

Iterator
begin()

Returns the beginning of the map.

Iterator
end()

Returns the end of the map.

ConstIterator
find(const KeyType& key) const

Finds the first occurrence of the key and returns iterator pointing to the found entry or iterator pointing to the end if entry is not found.

Iterator
find(const KeyType& key)

Finds the first occurrence of the key and returns iterator pointing to the found entry or iterator pointing to the end if entry is not found.

Iterator
insert(const ValueType& val)

Inserts the value into the map.

If one or more values already exist, new value is inserted at the end of the block. Thus, all the equal value entries are located sequentially at all times. Returns iterator pointing to the newly inserted value