std/map.h
template <class ktype, class vtype> struct map : list<implier<ktype, vtype> >
This structure implements a mapping from keys to values. In this structure, multiple values can be mapped to the same key.
map()
The default constructor, calls the default constructor of list.
list
iterator insert(ktype key, vtype value)
Places a key-value implier into the map in order sorted by the key.
key
iterator find(ktype key)
Returns an iterator to the first implier with the given key.
vtype &operator[](ktype key)
Finds the value mapped to the given key and returns it. If there isn't one, a value is inserted with the given key using the default constructor.
#include <std/ascii_stream.h> #include <std/map.h> using namespace core; int main() { map<int, int> m; m.insert(5, 3); m.insert(3, 10); m.insert(8, 2); cout << m << endl; return 0; }
There was an error while loading. Please reload this page.