C++如何实现哈希数据结构——map Library
C++ 的常用库
http://www.cplusplus.com/reference/
map Library
http://www.cplusplus.com/reference/stl/map/
简单用法如下:
|
Iterators of a map container point to elements of this value_type. Thus, for an iterator called it that points to an element of a map, its key and mapped value can be accessed respectively with:
1 2 3 4 |
|
Naturally, any other direct access operator, such as -> or [] can be used, for example:
1 2 |
|
举例:
#include <map>
using namespace std;
map <String,TEdit*> map1;
map1[ "Edit1 "]=Edit1;
map1[ "Edit2 "]=Edit2;
map1[ "Edit1 "]-> Text= "aaaaaa ";
map1[ "Edit2 "]-> Text= "bbbbbb ";