首先声明,我是一个菜鸟。一下文章中涌现技术误导情况盖不负责
先来段代码。我是在vs2012上验实的:
// priority_queue.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <iostream> //#include <map> //#include <string> using namespace std; int _tmain(int argc, _TCHAR* argv[]) { //map<int, string> mapStudent; //mapStudent.insert(pair<int, string>(1,"zl")); //mapStudent.insert(map<int, string>::value_type(2,"gs")); //map<int, string>::iterator it; //map<int, string>::reverse_iterator rit; //for(it = mapStudent.begin(); it != mapStudent.end(); it++) //{ // cout << it->first << " " << it->second << endl; //} //cout << "---------------" << endl; //for(rit = mapStudent.rbegin(); rit != mapStudent.rend(); rit++) //{ // cout << rit->first << " "<< rit->second << endl; //} string s("111111"); cout << s << endl; return 0; }
意注我注释掉了“
#include <string>"
d然后编译器就报string没实现<<符号载重。
如果我把面上红色这句加上的话,就不会涌现这样的问题。
详细问题我也不解了,可能怀疑是vs找到了另一个string类,而这个类是没有实现<<符号载重的。详细我也不太清晰啦
文章结束给大家分享下程序员的一些笑话语录: 腾讯的动作好快,2010年3月5日19时28分58秒,QQ同时在线人数1亿!刚刚看到编辑发布的文章,相差才2分钟,然后连专题页面都做出来了,他们早就预料到了吧?(其实,每人赠送10Q币,轻轻松松上两亿!)