C++开发--在Visual Studio2013中使用boost::split()编译过程中出现error C4996

Visual Studio is being overly cautious.  In debug mode, visual studio uses something called "Checked Iterators".  Pointers are also iterators, but the checking mechanism doesn‘t work with them.  So when a standard library algorithm is called with pointers, which is something that boost::split does, it issues this warning.

You‘ll get the same warning with this obviously safe code:

1 int main()
2 {
3     int x[10] = {};
4     int y[10] = {};
5     int *a = x, *b = y;
6     std::copy(a, a+10, b);
7 }

Disable the warning.  It‘s for beginners.  It‘s on by default for the safety of beginners, because if it was off by default, they wouldn‘t know how to turn it on.

Add -D_SCL_SECURE_NO_WARNINGS to the command line.  In the IDE, you can go to "Project -> Properties -> C/C++ -> Command Line" and add it in the additional options field.

 

ref:http://stackoverflow.com/questions/14141476/warning-with-boostsplit-when-compiling

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。