为什么调用boost::split()会发出这么多警告
Why does calling boost::split() give so many warnings?
我需要一个在dleimiter上拆分字符串的函数,而且我正在使用boost库做其他事情,所以我尝试使用boost::split。它有效,但它给了我很多警告,我想知道为什么。
以下是在MSVC++10中生成警告的简化代码:
#include <tchar.h>
#include <iostream>
#include <string>
#include <vector>
#include <boost/algorithm/string.hpp>
int _tmain(int argc, _TCHAR* argv[])
{
std::vector<std::string> split_vector;
boost::split(split_vector, "string,to,split", boost::is_any_of(","));
for(size_t i=0;i<split_vector.size();i++) {
std::cout << split_vector[i] << "n";
}
}
大约有100行警告,我不知道如何在这里制作可折叠/可滚动的东西,但它们都像:
c:program files (x86)microsoft visual studio 10.0vcincludexutility(2227): warning C4996: 'std::_Copy_impl': Function call with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++ 'Checked Iterators'
c:program files (x86)microsoft visual studio 10.0vcincludexutility(2212) : see declaration of 'std::_Copy_impl'
c:program filesboostboost_1_49_0boostalgorithmstringdetailclassification.hpp(102) : see reference to function template instantiation '_OutIt std::copy<const char*,char*>(_InIt,_InIt,_OutIt)' being compiled
with
[
_OutIt=char *,
_InIt=const char *
]
c:program filesboostboost_1_49_0boostalgorithmstringclassification.hpp(206) : see reference to function template instantiation 'boost::algorithm::detail::is_any_ofF<CharT>::is_any_ofF<boost::iterator_range<IteratorT>>(const RangeT &)' being compiled
with
[
CharT=char,
IteratorT=const char *,
RangeT=boost::iterator_range<const char *>
]
c:usersadministratordocumentsvisual studio 2010projectscas testingteststests.cpp(10) : see reference to function template instantiation 'boost::algorithm::detail::is_any_ofF<CharT> boost::algorithm::is_any_of<const char[2]>(RangeT (&))' being compiled
with
[
CharT=char,
RangeT=const char [2]
]
等等
有人知道发生了什么事吗?
警告的第一行告诉一切,包括为什么和如何避免,以及其他内容:若要禁用此警告,请使用-D_SCL_SECURE_NO_WARNINGS。因此,转到项目属性,将_SCL_SECURE_NO_WARNINGS放在预定义的宏中。
相关文章:
- 理解boost::asio-async_read在无需读取内容时的行为
- 警告处理为错误这里有什么问题
- 来自 Boost 的 JSON 解析器的警告 C4512 的解决方法
- 使用Boost :: black在boost :: variant中使用时,请警告编译器
- Boost序列化程序:除非使用虚拟类析构函数,否则将收到警告C4308
- boost::asio充满了警告
- jom.exe返回witd exitcode 2和许多Boost警告
- 为什么调用boost::split()会发出这么多警告
- 在 Boost 周围使用"#pragma warning"时的警告 C4503 包括
- 如何在x64上使用boost:gil:png_write_view避免此警告
- boost::lexical_cast编译时出现警告
- 抑制来自boost的警告
- 不能禁用由Boost库引起的警告
- Boost -在构建时关于解引用指针的警告
- 编译器警告在boost crc.hpp与Visual c++(错误C4244)
- boost::asio async_read_some async_read_until编译器警告
- 在c++ Builder中编译Boost库时的警告
- c++编译器在使用boost:: expression时给出了几页的警告
- 尝试初始化 wregex 对象时 boost 的 regex_traits_defaults.hpp 中的缩小转换警告
- 编译时带有boost::split的警告