Upgrade to boost::signals2 in VS2013 results in C4

2019-08-29 06:50发布

From the following compiler warning message in VS2013:

CL : warning : Boost.Signals is no longer being maintained and is now deprecated. Please switch to Boost.Signals2. To disable this warning message, define BOOST_SIGNALS_NO_DEPRECATION_WARNING.

I upgraded my code from boost::signals to boost::signals2.

Now there are even more numerous ugly warnings that go on and on and on, where this is just the start of it:

1>C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xmemory(348): warning C4996: 'std::_Uninitialized_copy0': 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 12.0\VC\include\xmemory(333) : see declaration of 'std::_Uninitialized_copy0'
1>          C:\Dev\ThirdParty\Boost\include\boost-1_59\boost/signals2/detail/auto_buffer.hpp(191) : see reference to function template instantiation '_FwdIt std::uninitialized_copy<I,boost::shared_ptr<void>*>(_InIt,_InIt,_FwdIt)' being compiled
1>          with
1>          [
1>              _FwdIt=boost::shared_ptr<void> *
1>  ,            I=boost::shared_ptr<void> *
1>  ,            _InIt=boost::shared_ptr<void> *
1>          ]
1>          C:\Dev\ThirdParty\Boost\include\boost-1_59\boost/signals2/detail/auto_buffer.hpp(178) : see reference to function template instantiation 'void boost::signals2::detail::auto_buffer<boost::shared_ptr<void>,boost::signals2::detail::store_n_objects<10>,boost::signals2::detail::default_grow_policy,std::allocator<T>>::copy_rai<I,false>(I,I,boost::shared_ptr<void> *,const boost::integral_constant<bool,false> &)' being compiled
1>          with
1>          [
1>              T=boost::shared_ptr<void>
1>  ,            I=boost::shared_ptr<void> *
1>          ]

I have seen this previously asked question and also many others, where the only solution suggested is to disable the warning; however that is a big hammer approach. As noted by @heavy-rocker-dude in the post above, this even occurs in the most trivial boost Hello World example (not cool).

Can anyone propose a solution that actually resolves the problem without compromising warnings?

0条回答
登录 后发表回答