为什么调用boost ::拆分()给这么多的警告? [英] Why does calling boost::split() give so many warnings?

查看:304
本文介绍了为什么调用boost ::拆分()给这么多的警告?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一个dleimiter分割字符串的函数,我使用Boost库为其他的事情,所以我尝试使用boost ::分裂。它的工作原理,但它给了我一堆警告,我想知道这是为什么。

I need a function for splitting strings on a dleimiter, and I'm using the boost library for other things, so I tried using boost::split. It works, but it gives me a bunch of warnings, and I'd like to know why.

下面是简化code产生的MSVC ++ 10的警告:

The following is simplified code that produces the warnings in 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警示线,我不知道如何使可折叠/滚动的东西在这里,但他们都是这样的:

There are about 100 lines of warnings, and I don't know how to make collapsible/scrollable stuff here, but they are all like:

c:\program files (x86)\microsoft visual studio 10.0\vc\include\xutility(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.0\vc\include\xutility(2212) : see declaration of 'std::_Copy_impl'
c:\program files\boost\boost_1_49_0\boost\algorithm\string\detail\classification.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 files\boost\boost_1_49_0\boost\algorithm\string\classification.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:\users\administrator\documents\visual studio 2010\projects\cas testing\tests\tests.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]
]

等。

任何人都知道这是怎么回事?

Anyone know what's going on?

推荐答案

警告的第一行会告诉你一切,无论是为什么和如何避免它,除其他事项:要禁止这种警告,使用-D_SCL_SECURE_NO_WARNINGS。所以去项目属性,并把_SCL_SECURE_NO_WARNINGS predefined宏之一。

The first line of the warning tells you everything, both why and how to avoid it, among other things this: To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. So go to the project properties, and put _SCL_SECURE_NO_WARNINGS among predefined macros.

这篇关于为什么调用boost ::拆分()给这么多的警告?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆