VC6 STL使用时候很多warning, stl使用以及消除warning的方法如下
2010-07-30 15:23
671 查看
以下程序出处: http://topic.csdn.net/u/20100702/11/fb811f9f-d2f3-4306-b2a9-3e9629824734.html
#pragma warning (disable:4786)
#include <list>
#include <string>
#include <iostream>
using namespace std ;
typedef list<string> LISTSTR;
// Try each of the four constructors
int main()
{
LISTSTR::iterator i;
LISTSTR test; // default constructor
test.insert(test.end(), "one");
test.insert(test.end(), "two");
LISTSTR test2(test); // construct from another list
LISTSTR test3(3, "three"); // add several <T>'s
LISTSTR test4(++test3.begin(), // add part of another list
test3.end());
// Print them all out
// one two
cout << "test:";
for (i = test.begin(); i != test.end(); ++i)
cout << " " << *i;
cout << endl;
// one two
cout << "test:";
for (i = test2.begin(); i != test2.end(); ++i)
cout << " " << *i;
cout << endl;
// three three three
cout << "test:";
for (i = test3.begin(); i != test3.end(); ++i)
cout << " " << *i;
cout << endl;
// three three
cout << "test:";
for (i = test4.begin(); i != test4.end(); ++i)
cout << " " << *i;
cout << endl;
}
#pragma warning (disable:4786)
#include <list>
#include <string>
#include <iostream>
using namespace std ;
typedef list<string> LISTSTR;
// Try each of the four constructors
int main()
{
LISTSTR::iterator i;
LISTSTR test; // default constructor
test.insert(test.end(), "one");
test.insert(test.end(), "two");
LISTSTR test2(test); // construct from another list
LISTSTR test3(3, "three"); // add several <T>'s
LISTSTR test4(++test3.begin(), // add part of another list
test3.end());
// Print them all out
// one two
cout << "test:";
for (i = test.begin(); i != test.end(); ++i)
cout << " " << *i;
cout << endl;
// one two
cout << "test:";
for (i = test2.begin(); i != test2.end(); ++i)
cout << " " << *i;
cout << endl;
// three three three
cout << "test:";
for (i = test3.begin(); i != test3.end(); ++i)
cout << " " << *i;
cout << endl;
// three three
cout << "test:";
for (i = test4.begin(); i != test4.end(); ++i)
cout << " " << *i;
cout << endl;
}
相关文章推荐
- 屏蔽vc6使用STL容器时的warning
- STL中stack/queue/map以及Boost unordered_map 的使用方法
- STL 中优先队列,队列以及statck的使用方法(priority_queu)
- 在使用Jquery的时候明明checked属性存在但是attr('checked')却显示undefine的原因以及解决方法
- VC6使用STL时很多C4786警告
- 阿里云安装mysql初始化的时候出现如下错误,以及解决方法
- 什么时候该使用多线程,以及更恰当的多线程编程方法之讨论
- 用类名做方法的返回值类型 在学习Java的初始阶段,很多同学使用基本数据类型定义变量和引用类型定义变量以及使用类名做方法的返回值类型常常不知所以。今天我以自己的解读方式和个人的理解作一个简单的解释,和
- 安卓各种资源介绍及使用方法以及工程各文件夹的介绍
- 2017cocoaPods更新和使用时报错以及报错解决方法
- C++ double转string类型以及MFC控件简单使用方法
- 方法以及方法的使用
- 注意:有的童鞋使用系统的UIScrollView的时候出现如下问题:
- 使用debmirror为Debian建立本地源的方法,以及遇到的GPG key验证错误问题的解决方法
- C++ STL--stack/queue 的使用方法
- Java序谈之String类的成员方法以及使用方法
- Spring学习之使用静态工厂方法以及实例工厂方法配置bean
- 消除js以及jsp文件中的警告方法
- 使用反射查询类的方法和字段以及使用IS运算符号类转换和AS运算符
- 怎样合理使用键盘以及键盘的保养方法