std::map是什么?

fbCstrike 2008-08-22 05:16:23
std::map<AnsiString, class Tclient_socket> client_map; 这个是啥意思?帮我解释解释。网上没有找到,说STD是性疾病传播什么的,我郁闷。
...全文
617 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
fbCstrike 2008-09-08
  • 打赏
  • 举报
回复
菠萝快车>>,超搞笑的啊,还有<<热带惊雷>>
jacknes009 2008-08-24
  • 打赏
  • 举报
回复
这个是定义了一个map容器对象

key:是String类型
value:是TClient_Socket类型

std是标准名字空间。map是属于stl
sunshine_anycall 2008-08-24
  • 打赏
  • 举报
回复
标准模板库
sunshine_anycall 2008-08-24
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 dxkh 的回复:]
应该是C++模板库STL?
[/Quote]
不是应该,本来就是
semimiracle 2008-08-23
  • 打赏
  • 举报
回复
std::map 不是在C++里定义的么?还有pair,multimap之类的
  • 打赏
  • 举报
回复
就是一个一对一的容器,根据下标可以得到直接对应的socket
存的时候也是存入一个字符串和socket句柄,
// map_op_insert.cpp
// compile with: /EHsc
#include <map>
#include <iostream>

int main( )
{
using namespace std;
typedef pair <const int, int> cInt2Int;
map <int, int> m1;
map <int, int> :: iterator pIter;

// Insert a data value of 10 with a key of 1
// into a map using the operator[] member function
m1[ 1 ] = 10;

// Compare other ways to insert objects into a map
m1.insert ( map <int, int> :: value_type ( 2, 20 ) );
m1.insert ( cInt2Int ( 3, 30 ) );

cout << "The keys of the mapped elements are:";
for ( pIter = m1.begin( ) ; pIter != m1.end( ) ; pIter++ )
cout << " " << pIter -> first;
cout << "." << endl;

cout << "The values of the mapped elements are:";
for ( pIter = m1.begin( ) ; pIter != m1.end( ) ; pIter++ )
cout << " " << pIter -> second;
cout << "." << endl;

// If the key already exists, operator[]
// changes the value of the datum in the element
m1[ 2 ] = 40;

// operator[] will also insert the value of the data
// type's default constructor if the value is unspecified
m1[5];

cout << "The keys of the mapped elements are now:";
for ( pIter = m1.begin( ) ; pIter != m1.end( ) ; pIter++ )
cout << " " << pIter -> first;
cout << "." << endl;

cout << "The values of the mapped elements are now:";
for ( pIter = m1.begin( ) ; pIter != m1.end( ) ; pIter++ )
cout << " " << pIter -> second;
cout << "." << endl;
}
我来看看CB 2008-08-22
  • 打赏
  • 举报
回复
应该是C++模板库STL?
jxw1987628 2008-08-22
  • 打赏
  • 举报
回复
这个是定义了一个map容器对象

key:是String类型
value:是TClient_Socket类型

std是标准名字空间。map是属于stl的东东!

13,825

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder相关内容讨论区
社区管理员
  • 基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧