frequency_map Class Template Reference
[Containers Library]

#include <stlsoft/containers/frequency_map.hpp>

Inheritance diagram for frequency_map:

stl_collection_tag collection_tag

List of all members.


Detailed Description

template<typename T, typename N = uint32_t>
class stlsoft::frequency_map< T, N >

A container that measures the frequency of the unique elements it contains.

Parameters:
T The value type of the container
N The count integer type. Defaults to uint32_t

Public Types

typedef frequency_map< T, N > class_type
 This type.
typedef map_type_::value_type value_type
 The value type.
typedef map_type_::const_iterator const_iterator
 The non-mutating (const) iterator type.
typedef map_type_::const_reference const_reference
 The non-mutating (const) reference type.
typedef map_type_::key_type key_type
 The key type.
typedef N count_type
 The count type.
typedef size_t size_type
 The size type.
typedef ss_ptrdiff_t difference_type
 The difference type.
typedef bool bool_type
 The boolean type.

Public Member Functions

 frequency_map ()
 Creates an instance of the map.
count_type push (key_type const &key)
 Pushes an entry onto the map.
void clear ()
 Removes all entries from the map.
class_typemerge (class_type const &rhs)
 Merges in all entries from the given map.
void swap (class_type &rhs) throw ()
 Swaps the state of the given instance with this instance.
const_iterator find (key_type const &key) const
 Returns an iterator for the entry representing the given key, or end() if no such entry exists.
count_type operator[] (key_type const &key) const
 Returns the count associated with the entry representing the given key, or 0 if no such entry exists.
count_type count (key_type const &key) const
 Returns the count associated with the entry representing the given key, or 0 if no such entry exists.
bool_type empty () const
 Indicates whether the map is empty.
size_type size () const
 The number of entries in the map.
const_iterator begin () const
 A non-mutating (const) iterator representing the start of the sequence.
const_iterator end () const
 A non-mutating (const) iterator representing the end-point of the sequence.

Member Typedef Documentation

typedef frequency_map<T, N> class_type

This type.

typedef map_type_::value_type value_type

The value type.

typedef map_type_::const_iterator const_iterator

The non-mutating (const) iterator type.

typedef map_type_::const_reference const_reference

The non-mutating (const) reference type.

typedef map_type_::key_type key_type

The key type.

typedef N count_type

The count type.

typedef size_t size_type

The size type.

The difference type.

typedef bool bool_type

The boolean type.


Constructor & Destructor Documentation

frequency_map (  )  [inline]

Creates an instance of the map.

References STLSOFT_STATIC_ASSERT.


Member Function Documentation

count_type push ( key_type const &  key  )  [inline]

Pushes an entry onto the map.

If the entry already exists in the map, its count will be increased by 1. If it does not previously exist, it will be added with an initial count of one

Note:
Thread-safety: it is strongly exception-safe - if an entry cannot be added,

References ss_typename_param_k.

void clear (  )  [inline]

Removes all entries from the map.

class_type& merge ( class_type const &  rhs  )  [inline]

Merges in all entries from the given map.

References frequency_map::begin(), frequency_map::end(), frequency_map::m_map, and frequency_map::swap().

void swap ( class_type rhs  )  throw () [inline]

Swaps the state of the given instance with this instance.

References stlsoft::std_swap().

Referenced by frequency_map::merge().

const_iterator find ( key_type const &  key  )  const [inline]

Returns an iterator for the entry representing the given key, or end() if no such entry exists.

count_type operator[] ( key_type const &  key  )  const [inline]

Returns the count associated with the entry representing the given key, or 0 if no such entry exists.

References frequency_map::count().

count_type count ( key_type const &  key  )  const [inline]

Returns the count associated with the entry representing the given key, or 0 if no such entry exists.

Referenced by frequency_map::operator[]().

bool_type empty (  )  const [inline]

Indicates whether the map is empty.

size_type size (  )  const [inline]

The number of entries in the map.

Remarks:
This may not be the same as the number of calls to push()

const_iterator begin (  )  const [inline]

A non-mutating (const) iterator representing the start of the sequence.

Referenced by frequency_map::merge().

const_iterator end (  )  const [inline]

A non-mutating (const) iterator representing the end-point of the sequence.

Referenced by frequency_map::merge().


The documentation for this class was generated from the following file:

Generated on Thu Jun 10 08:58:42 2010 for STLSoft by  doxygen 1.5.6