From 92b86577ed847ce8dd3eaf7820bda86bdd925e73 Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Fri, 30 Mar 2018 12:54:48 +0200 Subject: [PATCH] Avoid auto_ptr in bundled boost --- .../boost/date_time/gregorian/greg_facet.hpp | 8 ++++++++ .../include/boost/detail/lightweight_thread.hpp | 12 ++++++++++++ .../include/boost/graph/detail/adjacency_list.hpp | 4 ++++ .../boost-1.62.0/include/boost/iostreams/chain.hpp | 5 +++++ .../include/boost/random/uniform_on_sphere.hpp | 8 ++++++-- .../home/classic/core/non_terminal/impl/grammar.ipp | 5 +++++ .../boost/spirit/home/classic/symbols/impl/tst.ipp | 8 ++++++++ .../spirit/home/support/detail/lexer/generator.hpp | 13 +++++++++++++ 8 files changed, 61 insertions(+), 2 deletions(-) diff --git a/bundled/boost-1.62.0/include/boost/date_time/gregorian/greg_facet.hpp b/bundled/boost-1.62.0/include/boost/date_time/gregorian/greg_facet.hpp index b8c6d57fe5..45d9da1d40 100644 --- a/bundled/boost-1.62.0/include/boost/date_time/gregorian/greg_facet.hpp +++ b/bundled/boost-1.62.0/include/boost/date_time/gregorian/greg_facet.hpp @@ -290,7 +290,11 @@ namespace gregorian { * names as a default. */ catch(std::bad_cast&){ charT a = '\0'; +#if defined(BOOST_NO_CXX11_SMART_PTR) std::auto_ptr< const facet_def > f(create_facet_def(a)); +#else + std::unique_ptr< const facet_def > f(create_facet_def(a)); +#endif num = date_time::find_match(f->get_short_month_names(), f->get_long_month_names(), (greg_month::max)(), s); // greg_month spans 1..12, so max returns the array size, @@ -332,7 +336,11 @@ namespace gregorian { * names as a default. */ catch(std::bad_cast&){ charT a = '\0'; +#if defined(BOOST_NO_CXX11_SMART_PTR) std::auto_ptr< const facet_def > f(create_facet_def(a)); +#else + std::unique_ptr< const facet_def > f(create_facet_def(a)); +#endif num = date_time::find_match(f->get_short_weekday_names(), f->get_long_weekday_names(), (greg_weekday::max)() + 1, s); // greg_weekday spans 0..6, so increment is needed diff --git a/bundled/boost-1.62.0/include/boost/detail/lightweight_thread.hpp b/bundled/boost-1.62.0/include/boost/detail/lightweight_thread.hpp index 6fe70a613d..090eeb56a7 100644 --- a/bundled/boost-1.62.0/include/boost/detail/lightweight_thread.hpp +++ b/bundled/boost-1.62.0/include/boost/detail/lightweight_thread.hpp @@ -77,7 +77,11 @@ public: extern "C" void * lw_thread_routine( void * pv ) { +#if defined(BOOST_NO_CXX11_SMART_PTR) std::auto_ptr pt( static_cast( pv ) ); +#else + std::unique_ptr pt( static_cast( pv ) ); +#endif pt->run(); @@ -88,7 +92,11 @@ extern "C" void * lw_thread_routine( void * pv ) unsigned __stdcall lw_thread_routine( void * pv ) { +#if defined(BOOST_NO_CXX11_SMART_PTR) std::auto_ptr pt( static_cast( pv ) ); +#else + std::unique_ptr pt( static_cast( pv ) ); +#endif pt->run(); @@ -117,7 +125,11 @@ private: template int lw_thread_create( pthread_t & pt, F f ) { +#if defined(BOOST_NO_CXX11_SMART_PTR) std::auto_ptr p( new lw_thread_impl( f ) ); +#else + std::unique_ptr p( new lw_thread_impl( f ) ); +#endif int r = pthread_create( &pt, 0, lw_thread_routine, p.get() ); diff --git a/bundled/boost-1.62.0/include/boost/graph/detail/adjacency_list.hpp b/bundled/boost-1.62.0/include/boost/graph/detail/adjacency_list.hpp index 3c3ab0ec38..b6955fd853 100644 --- a/bundled/boost-1.62.0/include/boost/graph/detail/adjacency_list.hpp +++ b/bundled/boost-1.62.0/include/boost/graph/detail/adjacency_list.hpp @@ -289,7 +289,11 @@ namespace boost { // invalidation for add_edge() with EdgeList=vecS. Instead we // hold a pointer to the property. std::auto_ptr is not // a perfect fit for the job, but it is darn close. +#if defined(BOOST_NO_CXX11_SMART_PTR) std::auto_ptr m_property; +#else + std::unique_ptr m_property; +#endif }; #else template diff --git a/bundled/boost-1.62.0/include/boost/iostreams/chain.hpp b/bundled/boost-1.62.0/include/boost/iostreams/chain.hpp index a199c9df38..bc0fab58ea 100644 --- a/bundled/boost-1.62.0/include/boost/iostreams/chain.hpp +++ b/bundled/boost-1.62.0/include/boost/iostreams/chain.hpp @@ -243,8 +243,13 @@ private: pback_size != -1 ? pback_size : pimpl_->pback_size_; +#if defined(BOOST_NO_CXX11_SMART_PTR) std::auto_ptr buf(new streambuf_t(t, buffer_size, pback_size)); +#else + std::unique_ptr + buf(new streambuf_t(t, buffer_size, pback_size)); +#endif list().push_back(buf.get()); buf.release(); if (is_device::value) { diff --git a/bundled/boost-1.62.0/include/boost/random/uniform_on_sphere.hpp b/bundled/boost-1.62.0/include/boost/random/uniform_on_sphere.hpp index 72c25ef781..ce2e35237e 100644 --- a/bundled/boost-1.62.0/include/boost/random/uniform_on_sphere.hpp +++ b/bundled/boost-1.62.0/include/boost/random/uniform_on_sphere.hpp @@ -225,8 +225,12 @@ public: } } while(sqsum == 0); // for all i: result[i] /= sqrt(sqsum) - std::transform(_container.begin(), _container.end(), _container.begin(), - std::bind2nd(std::multiplies(), 1/sqrt(sqsum))); + RealType inverse_distance = 1 / sqrt(sqsum); + for(typename Cont::iterator it = _container.begin(); + it != _container.end(); + ++it) { + *it *= inverse_distance; + } } } return _container; diff --git a/bundled/boost-1.62.0/include/boost/spirit/home/classic/core/non_terminal/impl/grammar.ipp b/bundled/boost-1.62.0/include/boost/spirit/home/classic/core/non_terminal/impl/grammar.ipp index 002d221eeb..96677e7020 100644 --- a/bundled/boost-1.62.0/include/boost/spirit/home/classic/core/non_terminal/impl/grammar.ipp +++ b/bundled/boost-1.62.0/include/boost/spirit/home/classic/core/non_terminal/impl/grammar.ipp @@ -156,8 +156,13 @@ struct grammar_definition if (definitions[id]!=0) return *definitions[id]; +#if defined(BOOST_NO_CXX11_SMART_PTR) std::auto_ptr result(new definition_t(target_grammar->derived())); +#else + std::unique_ptr + result(new definition_t(target_grammar->derived())); +#endif #ifdef BOOST_SPIRIT_THREADSAFE boost::unique_lock lock(helpers.mutex()); diff --git a/bundled/boost-1.62.0/include/boost/spirit/home/classic/symbols/impl/tst.ipp b/bundled/boost-1.62.0/include/boost/spirit/home/classic/symbols/impl/tst.ipp index 1a4a0c1052..305d40025c 100644 --- a/bundled/boost-1.62.0/include/boost/spirit/home/classic/symbols/impl/tst.ipp +++ b/bundled/boost-1.62.0/include/boost/spirit/home/classic/symbols/impl/tst.ipp @@ -62,7 +62,11 @@ BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN tst_node* clone() const { +#if defined(BOOST_NO_CXX11_SMART_PTR) std::auto_ptr copy(new tst_node(value)); +#else + std::unique_ptr copy(new tst_node(value)); +#endif if (left) copy->left = left->clone(); @@ -75,7 +79,11 @@ BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN } else { +#if defined(BOOST_NO_CXX11_SMART_PTR) std::auto_ptr mid_data(new T(*middle.data)); +#else + std::unique_ptr mid_data(new T(*middle.data)); +#endif copy->middle.data = mid_data.release(); } diff --git a/bundled/boost-1.62.0/include/boost/spirit/home/support/detail/lexer/generator.hpp b/bundled/boost-1.62.0/include/boost/spirit/home/support/detail/lexer/generator.hpp index daa06e7944..49f93e491d 100644 --- a/bundled/boost-1.62.0/include/boost/spirit/home/support/detail/lexer/generator.hpp +++ b/bundled/boost-1.62.0/include/boost/spirit/home/support/detail/lexer/generator.hpp @@ -116,10 +116,18 @@ public: protected: typedef detail::basic_charset charset; typedef detail::ptr_list charset_list; +#if defined(BOOST_NO_CXX11_SMART_PTR) typedef std::auto_ptr charset_ptr; +#else + typedef std::unique_ptr charset_ptr; +#endif typedef detail::equivset equivset; typedef detail::ptr_list equivset_list; +#if defined(BOOST_NO_CXX11_SMART_PTR) typedef std::auto_ptr equivset_ptr; +#else + typedef std::unique_ptr equivset_ptr; +#endif typedef typename charset::index_set index_set; typedef std::vector index_set_vector; typedef detail::basic_parser parser; @@ -377,8 +385,13 @@ protected: if (followpos_->empty ()) return npos; std::size_t index_ = 0; +#if defined(BOOST_NO_CXX11_SMART_PTR) std::auto_ptr set_ptr_ (new node_set); std::auto_ptr vector_ptr_ (new node_vector); +#else + std::unique_ptr set_ptr_ (new node_set); + std::unique_ptr vector_ptr_ (new node_vector); +#endif for (typename detail::node::node_vector::const_iterator iter_ = followpos_->begin (), end_ = followpos_->end (); -- 2.39.5