1

可能重复:
C++ Boost:这个警告的原因是什么?

此代码取自 boost 文档http://www.boost.org/doc/libs/1_51_0/doc/html/string_algo/usage.html#id3240174

    using namespace boost;
    string str1("hello abc-*-ABC-*-aBc goodbye");
    typedef vector< string > split_vector_type;
    split_vector_type SplitVec;
    split( SplitVec, str1, is_any_of("-*"), token_compress_on ); 

我收到讨厌的编译器警告

1>c:\program files\boost\boost_1_51\boost\algorithm\string\detail\classification.hpp(102) : warning C4996: 'std::copy': 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'
1>        c:\program files (x86)\microsoft visual studio 9.0\vc\include\xutility(2550) : see declaration of 'std::copy'
1>        c:\program files\boost\boost_1_51\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
1>        with
1>        [
1>            CharT=char,
1>            IteratorT=const char_type *,
1>            RangeT=boost::iterator_range<const char_type *>
1>        ]
1>        c:\users\james\code\ecrew\work\src\cinstrumentpanel.cpp(71) : see reference to function template instantiation 'boost::algorithm::detail::is_any_ofF<CharT> boost::algorithm::is_any_of<const char[3]>(RangeT (&))' being compiled
1>        with
1>        [
1>            CharT=char,
1>            RangeT=const char [3]
1>        ]

为什么?

除了简单地用 _SCL_SECURE_NO_WARNINGS 压制它们之外,我如何才能摆脱警告

提升版本 1.51

MSVSC2008

4

0 回答 0