Ash*_*ppa 6 warnings iterator visual-c++
在警告级别4(/ W4)编译代码时,我在参数为C数组的调用(而不是像向量的STL容器)上收到C4996警告std::copy().修复此问题的推荐解决方案似乎是使用stdext :: checked_array_iterator.
有什么用的stdext :: checked_array_iterator?它是如何工作的?
为什么它不会对在Visual C++ 2010下编译的这段错误代码发出任何编译警告?:
#include <algorithm>
#include <iterator>
using namespace std;
int main()
{
int arr0[5] = {100, 99, 98, 97, 96};
int arr1[3];
copy( arr0, arr0 + 5, stdext::checked_array_iterator<int*>( arr1, 3 ) );
return 0;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1168 次 |
| 最近记录: |