作者EEmuse2 (忘了密码)
看板EE_DSnP
标题Re: [问题] 关於 lecture#4 的更正
时间Sat Nov 18 16:50:33 2006
※ 引述《samuelduan ()》之铭言:
: map<string, int> scores;
: pair<map<string, int>::iterator, bool> p
: = scores.insert(make_pair(“John”, 100));
~~~~~~~~~~~~~~~~~~~~~
: 上面的是更正的版本
: 而我之前查了一些资料
: 有人写成
: map<string, int> scores;
: pair<map<string, int>::iterator, bool> p
: = scores.insert(pair(“John”, 100));
: 或是
: map<string, int> scores;
: pair<map<string, int>::iterator, bool> p
: = scores.insert(map<string, int>::value_type(“John”, 100));
: 不知道上面几种写法有什麽不一样呢?
不好意思,想请问一下
我研究了很久,还是不太会pair的用法,我只知道first,second分别代表
construct出来的物件,讲义的这整句语法意思有点雾煞煞...
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 140.112.4.247
1F:→ EEmuse2:另外想再问,CmdRegPair物件可以用在哪@@ 11/18 16:51