StanfordCPPLib
Public Types | Public Member Functions | List of all members
Map< KeyType, ValueType > Class Template Reference

#include "map.h"

Public Types

using const_iterator = stanfordcpplib::collections::ProjectingIterator< stanfordcpplib::collections::CheckedIterator< typename MapType::const_iterator > >
 
using iterator = const_iterator
 

Public Member Functions

 Map()
 
 Map(std::function< bool(const KeyType &, const KeyType &)> lessFunc)
 
 Map(std::initializer_list< std::pair< const KeyType, ValueType >> list)
 
 Map(std::initializer_list< std::pair< const KeyType, ValueType >> list, std::function< bool(const KeyType &, const KeyType &)> lessFunc)
 
~Map()=default
 
void add(const KeyType &key, const ValueType &value)
 
MapaddAll(const Map &map2)
 
KeyType back() const
 
const_iterator begin() const
 
void clear()
 
bool containsKey(const KeyType &key) const
 
const_iterator end() const
 
bool equals(const Map &map2) const
 
KeyType front() const
 
ValueType get(const KeyType &key) const
 
bool isEmpty() const
 
Vector< KeyType > keys() const
 
void mapAll(std::function< void(const KeyType &, const ValueType &)> fn) const
 
bool operator!=(const Map &map2) const
 
Map operator*(const Map &map2) const
 
Mapoperator*=(const Map &map2)
 
Map operator+(const Map &map2) const
 
Mapoperator+=(const Map &map2)
 
Map operator-(const Map &map2) const
 
Mapoperator-=(const Map &map2)
 
bool operator<(const Map &map2) const
 
bool operator<=(const Map &map2) const
 
bool operator==(const Map &map2) const
 
bool operator>(const Map &map2) const
 
bool operator>=(const Map &map2) const
 
ValueType & operator[](const KeyType &key)
 
ValueType operator[](const KeyType &key) const
 
void put(const KeyType &key, const ValueType &value)
 
MapputAll(const Map &map2)
 
void remove(const KeyType &key)
 
MapremoveAll(const Map &map2)
 
MapretainAll(const Map &map2)
 
int size() const
 
string toString() const
 
Vector< ValueType > values() const
 

Member Typedef Documentation

◆ const_iterator

◆ iterator

Constructor & Destructor Documentation

◆ Map() [1/4]

Map ( )

◆ Map() [2/4]

Map ( std::function< bool(const KeyType &, const KeyType &)>  lessFunc)

◆ Map() [3/4]

Map ( std::initializer_list< std::pair< const KeyType, ValueType >>  list)

◆ Map() [4/4]

Map ( std::initializer_list< std::pair< const KeyType, ValueType >>  list,
std::function< bool(const KeyType &, const KeyType &)>  lessFunc 
)

◆ ~Map()

virtual ~Map ( )
virtualdefault

Member Function Documentation

◆ add()

void add ( const KeyType &  key,
const ValueType &  value 
)

◆ addAll()

Map< KeyType, ValueType > & addAll ( const Map< KeyType, ValueType > &  map2)

◆ back()

KeyType back ( ) const

◆ begin()

Map< KeyType, ValueType >::iterator begin ( ) const

◆ clear()

void clear ( )

◆ containsKey()

bool containsKey ( const KeyType &  key) const

◆ end()

Map< KeyType, ValueType >::iterator end ( ) const

◆ equals()

bool equals ( const Map< KeyType, ValueType > &  map2) const

◆ front()

KeyType front ( ) const

◆ get()

ValueType get ( const KeyType &  key) const

◆ isEmpty()

bool isEmpty ( ) const

◆ keys()

Vector< KeyType > keys ( ) const

◆ mapAll()

void mapAll ( std::function< void(const KeyType &, const ValueType &)>  fn) const

◆ operator!=()

bool operator!= ( const Map< KeyType, ValueType > &  map2) const

◆ operator*()

Map< KeyType, ValueType > operator* ( const Map< KeyType, ValueType > &  map2) const

◆ operator*=()

Map< KeyType, ValueType > & operator*= ( const Map< KeyType, ValueType > &  map2)

◆ operator+()

Map< KeyType, ValueType > operator+ ( const Map< KeyType, ValueType > &  map2) const

◆ operator+=()

Map< KeyType, ValueType > & operator+= ( const Map< KeyType, ValueType > &  map2)

◆ operator-()

Map< KeyType, ValueType > operator- ( const Map< KeyType, ValueType > &  map2) const

◆ operator-=()

Map< KeyType, ValueType > & operator-= ( const Map< KeyType, ValueType > &  map2)

◆ operator<()

bool operator< ( const Map< KeyType, ValueType > &  map2) const

◆ operator<=()

bool operator<= ( const Map< KeyType, ValueType > &  map2) const

◆ operator==()

bool operator== ( const Map< KeyType, ValueType > &  map2) const

◆ operator>()

bool operator> ( const Map< KeyType, ValueType > &  map2) const

◆ operator>=()

bool operator>= ( const Map< KeyType, ValueType > &  map2) const

◆ operator[]() [1/2]

ValueType & operator[] ( const KeyType &  key)

◆ operator[]() [2/2]

ValueType operator[] ( const KeyType &  key) const

◆ put()

void put ( const KeyType &  key,
const ValueType &  value 
)

◆ putAll()

Map< KeyType, ValueType > & putAll ( const Map< KeyType, ValueType > &  map2)

◆ remove()

void remove ( const KeyType &  key)

◆ removeAll()

Map< KeyType, ValueType > & removeAll ( const Map< KeyType, ValueType > &  map2)

◆ retainAll()

Map< KeyType, ValueType > & retainAll ( const Map< KeyType, ValueType > &  map2)

◆ size()

int size ( ) const

◆ toString()

string toString ( ) const

◆ values()

Vector< ValueType > values ( ) const