标签:
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
C++开发--在Visual Studio2013中使用boost::split()编译过程中出现error C4996
标签:
原文地址:http://www.cnblogs.com/feiling/p/4248550.html