关于map和make_pair的奇怪问题
编译如下的代码时,为何会提示make_pair identifier not found?
map make_pair
//
#include <iostream>
#include <map>
#include <string>
#include <utility>
using std::pair;
using std::map;
using std::string;
using std::cin;
using std::cout;
using std::endl;
int main()
{
// count number of times each word occurs in the input
map<string, int> word_count; // empty map from string to int
// insert default initialized element with key Anna; then assign 1 to its value
//word_count["Anna"]=1;
string word;
cout<<"\nInput as many words as you wish:\n";
while(cin>>word)
++word_count[word];
cin.clear();
make_pair("SunGohan",3);
getchar();
}
using namespace std;你在VS下调用这个试试就知道了(VC6没这个问题,太老了不符合标准)
template<typename T>
T max(T a,T b){
return a>b?a:b;
}