]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/boost/multi_index/detail/auto_space.hpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / boost / multi_index / detail / auto_space.hpp
index 911f810f8fa659a76c840e94fa98d884a5107ee9..ca19b320ad510c64ee15e816a586340bb7ba5960 100644 (file)
@@ -15,8 +15,8 @@
 
 #include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
 #include <algorithm>
-#include <boost/detail/allocator_utilities.hpp>
 #include <boost/multi_index/detail/adl_swap.hpp>
+#include <boost/multi_index/detail/allocator_traits.hpp>
 #include <boost/noncopyable.hpp>
 #include <memory>
 
@@ -45,34 +45,18 @@ namespace detail{
 template<typename T,typename Allocator=std::allocator<T> >
 struct auto_space:private noncopyable
 {
-  typedef typename boost::detail::allocator::rebind_to<
-    Allocator,T
-  >::type allocator;
-#ifdef BOOST_NO_CXX11_ALLOCATOR
-  typedef typename allocator::pointer pointer;
-#else
-  typedef std::allocator_traits<allocator> traits;
-  typedef typename traits::pointer pointer;
-#endif
-
-  explicit auto_space(const Allocator& al=Allocator(),std::size_t n=1):
-  al_(al),n_(n),
-#ifdef BOOST_NO_CXX11_ALLOCATOR
-  data_(n_?al_.allocate(n_):pointer(0))
-#else
-  data_(n_?traits::allocate(al_,n_):pointer(0))
-#endif
+  typedef typename rebind_alloc_for<
+    Allocator,T>
+  ::type                                   allocator;
+  typedef allocator_traits<allocator>      alloc_traits;
+  typedef typename alloc_traits::pointer   pointer;
+  typedef typename alloc_traits::size_type size_type;
+
+  explicit auto_space(const Allocator& al=Allocator(),size_type n=1):
+  al_(al),n_(n),data_(n_?alloc_traits::allocate(al_,n_):pointer(0))
   {}
 
-  ~auto_space()
-  {
-    if(n_)
-#ifdef BOOST_NO_CXX11_ALLOCATOR
-      al_.deallocate(data_,n_);
-#else
-      traits::deallocate(al_,data_,n_);
-#endif
-  }
+  ~auto_space(){if(n_)alloc_traits::deallocate(al_,data_,n_);}
 
   Allocator get_allocator()const{return al_;}
 
@@ -86,9 +70,9 @@ struct auto_space:private noncopyable
   }
     
 private:
-  allocator   al_;
-  std::size_t n_;
-  pointer     data_;
+  allocator al_;
+  size_type n_;
+  pointer   data_;
 };
 
 template<typename T,typename Allocator>