C++ 的常用库
http://www.cplusplus.com/reference/

map Library

http://www.cplusplus.com/reference/stl/map/

 

简单用法如下:

 
typedef pair<const Key, T> value_type;



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
map<Key,T>::iterator it;
(*it).first;             // the key value (of type Key)
(*it).second;            // the mapped value (of type T)
(*it);                   // the "element value" (of type pair<const Key,T>) 


Naturally, any other direct access operator, such as -> or [] can be used, for example:

1
2
it->first;               // same as (*it).first   (the key value)
it->second;              // same as (*it).second  (the mapped value) 

 

 

举例:

 

#include   <map>
using   namespace   std;

        map <String,TEdit*>     map1;

        map1[ "Edit1 "]=Edit1;
        map1[ "Edit2 "]=Edit2;

        map1[ "Edit1 "]-> Text= "aaaaaa ";
        map1[ "Edit2 "]-> Text= "bbbbbb ";

 

相关文章:

  • 2021-10-02
  • 2021-07-09
  • 2021-12-30
  • 2021-07-15
  • 2022-01-08
  • 2022-01-11
  • 2021-12-19
猜你喜欢
  • 2023-03-20
  • 2022-12-23
  • 2021-06-23
  • 2021-04-17
  • 2021-10-01
  • 2021-06-26
  • 2021-09-07
相关资源
相似解决方案