→ EEmuse2:另外想再問,CmdRegPair物件可以用在哪@@ 11/18 16:51
※ 引述《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