From 4a6944adbca1d56ad53762ee31847619d3106725 Mon Sep 17 00:00:00 2001 From: Daniela Engert Date: Sun, 17 Dec 2017 09:59:59 +0100 Subject: [PATCH] replace members of std::allocate which are deprecated in c++17 by their cousins from std::allocator_traits. Signed-off-by: Daniela Engert --- factory/test/factory_with_allocator.cpp | 5 +++++ include/boost/functional/factory.hpp | 9 +++++++++ 2 files changed, 14 insertions(+) diff --git a/factory/test/factory_with_allocator.cpp b/factory/test/factory_with_allocator.cpp index decd656..35e8c16 100644 --- a/factory/test/factory_with_allocator.cpp +++ b/factory/test/factory_with_allocator.cpp @@ -13,6 +13,11 @@ #include #include +#ifdef BOOST_MSVC +// none of the deprecated members of std::allocate are used here +# pragma warning(disable:4996) // Various members of std::allocator are deprecated in C++17 +#endif + using std::size_t; class sum diff --git a/include/boost/functional/factory.hpp b/include/boost/functional/factory.hpp index 67fee71..94c55af 100644 --- a/include/boost/functional/factory.hpp +++ b/include/boost/functional/factory.hpp @@ -74,14 +74,23 @@ namespace boost template< class Pointer, class Allocator, factory_alloc_propagation AP > class factory +#if defined(BOOST_NO_CXX11_ALLOCATOR) : private Allocator::template rebind< typename boost::pointee< typename boost::remove_cv::type >::type >::other +#else + : private std::allocator_traits::template rebind_alloc< + typename boost::pointee< typename boost::remove_cv::type >::type > +#endif { public: typedef typename boost::remove_cv::type result_type; typedef typename boost::pointee::type value_type; +#if defined(BOOST_NO_CXX11_ALLOCATOR) typedef typename Allocator::template rebind::other +#else + typedef typename std::allocator_traits::template rebind_alloc +#endif allocator_type; explicit factory(allocator_type const & a = allocator_type())