Merge pull request #7 from DanielaE/fix/replace-deprecated-allocator-members

replace members of std::allocate which are deprecated in c++17 by the…
This commit is contained in:
Daniel James
2017-12-17 11:28:05 +00:00
committed by GitHub
2 changed files with 14 additions and 0 deletions

View File

@ -13,6 +13,11 @@
#include <memory> #include <memory>
#include <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>
#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; using std::size_t;
class sum class sum

View File

@ -74,14 +74,23 @@ namespace boost
template< class Pointer, class Allocator, factory_alloc_propagation AP > template< class Pointer, class Allocator, factory_alloc_propagation AP >
class factory class factory
#if defined(BOOST_NO_CXX11_ALLOCATOR)
: private Allocator::template rebind< typename boost::pointee< : private Allocator::template rebind< typename boost::pointee<
typename boost::remove_cv<Pointer>::type >::type >::other typename boost::remove_cv<Pointer>::type >::type >::other
#else
: private std::allocator_traits<Allocator>::template rebind_alloc<
typename boost::pointee< typename boost::remove_cv<Pointer>::type >::type >
#endif
{ {
public: public:
typedef typename boost::remove_cv<Pointer>::type result_type; typedef typename boost::remove_cv<Pointer>::type result_type;
typedef typename boost::pointee<result_type>::type value_type; typedef typename boost::pointee<result_type>::type value_type;
#if defined(BOOST_NO_CXX11_ALLOCATOR)
typedef typename Allocator::template rebind<value_type>::other typedef typename Allocator::template rebind<value_type>::other
#else
typedef typename std::allocator_traits<Allocator>::template rebind_alloc<value_type>
#endif
allocator_type; allocator_type;
explicit factory(allocator_type const & a = allocator_type()) explicit factory(allocator_type const & a = allocator_type())