multimapwithdefault< Key, T, Compare > Class Template Reference

#include <multimapwdef.h>

Inheritance diagram for multimapwithdefault< Key, T, Compare >:
Inheritance graph
[legend]
Collaboration diagram for multimapwithdefault< Key, T, Compare >:
Collaboration graph
[legend]

List of all members.

Public Types

typedef std::pair< const Key, T > value_type

Public Member Functions

T & getWithDefault (const Key &k, const T &defaultValue)
bool has (const Key &k, const T &val) const
T & operator[] (const Key &k)

Detailed Description

template<class Key, class T, class Compare>
class multimapwithdefault< Key, T, Compare >

Definition at line 11 of file multimapwdef.h.


Member Typedef Documentation

template<class Key , class T , class Compare >
typedef std::pair<const Key, T> multimapwithdefault< Key, T, Compare >::value_type

Definition at line 13 of file multimapwdef.h.


Member Function Documentation

template<class Key , class T , class Compare >
T& multimapwithdefault< Key, T, Compare >::getWithDefault ( const Key &  k,
const T &  defaultValue 
) [inline]

Definition at line 14 of file multimapwdef.h.

00014                                                            {
00015         if (find(k) == this->end()) {
00016             insert(value_type(k, defaultValue));
00017         }
00018         return (*(find(k))).second;
00019     }

template<class Key , class T , class Compare >
bool multimapwithdefault< Key, T, Compare >::has ( const Key &  k,
const T &  val 
) const [inline]

Definition at line 27 of file multimapwdef.h.

00027                                                {
00028         typename std::multimap<Key, T, Compare>::const_iterator start = this->lower_bound(k);
00029         typename std::multimap<Key, T, Compare>::const_iterator end = this->upper_bound(k);
00030         for (; start!=end; start++) {
00031             if (start->second == val)
00032                 return true;
00033         }
00034         return false;
00035     }

template<class Key , class T , class Compare >
T& multimapwithdefault< Key, T, Compare >::operator[] ( const Key &  k  )  [inline]

Definition at line 21 of file multimapwdef.h.

00021                                 {
00022         if (this->find(k) == this->end()) {
00023             this->insert(value_type(k, T()));
00024         }
00025         return (*(this->find(k))).second;
00026     }


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

Generated on 18 Mar 2013 for The SWORD Project by  doxygen 1.6.1