]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/boost/circular_buffer/base.hpp
import quincy beta 17.1.0
[ceph.git] / ceph / src / boost / boost / circular_buffer / base.hpp
index ac960960477503185605c8296a45a3907431dc3c..47441544d4df7dbac002cfca7d62d091cdb6d338 100644 (file)
@@ -21,7 +21,7 @@
 #include <boost/config.hpp>
 #include <boost/concept_check.hpp>
 #include <boost/limits.hpp>
-#include <boost/circular_buffer/allocators.hpp>
+#include <boost/core/allocator_access.hpp>
 #include <boost/core/empty_value.hpp>
 #include <boost/type_traits/is_stateless.hpp>
 #include <boost/type_traits/is_integral.hpp>
@@ -99,13 +99,13 @@ public:
     typedef circular_buffer<T, Alloc> this_type;
 
     //! The type of elements stored in the <code>circular_buffer</code>.
-    typedef typename cb_details::allocator_traits<Alloc>::value_type value_type;
+    typedef typename Alloc::value_type value_type;
 
     //! A pointer to an element.
-    typedef typename cb_details::allocator_traits<Alloc>::pointer pointer;
+    typedef typename allocator_pointer<Alloc>::type pointer;
 
     //! A const pointer to the element.
-    typedef typename cb_details::allocator_traits<Alloc>::const_pointer const_pointer;
+    typedef typename allocator_const_pointer<Alloc>::type const_pointer;
 
     //! A reference to an element.
     typedef value_type& reference;
@@ -117,13 +117,13 @@ public:
     /*!
         (A signed integral type used to represent the distance between two iterators.)
     */
-    typedef typename cb_details::allocator_traits<Alloc>::difference_type difference_type;
+    typedef typename allocator_difference_type<Alloc>::type difference_type;
 
     //! The size type.
     /*!
         (An unsigned integral type that can represent any non-negative value of the container's distance type.)
     */
-    typedef typename cb_details::allocator_traits<Alloc>::size_type size_type;
+    typedef typename allocator_size_type<Alloc>::type size_type;
 
     //! The type of an allocator used in the <code>circular_buffer</code>.
     typedef Alloc allocator_type;
@@ -131,10 +131,10 @@ public:
 // Iterators
 
     //! A const (random access) iterator used to iterate through the <code>circular_buffer</code>.
-    typedef cb_details::iterator< circular_buffer<T, Alloc>, cb_details::const_traits<cb_details::allocator_traits<Alloc> > > const_iterator;
+    typedef cb_details::iterator< circular_buffer<T, Alloc>, cb_details::const_traits<Alloc> > const_iterator;
 
     //! A (random access) iterator used to iterate through the <code>circular_buffer</code>.
-    typedef cb_details::iterator< circular_buffer<T, Alloc>, cb_details::nonconst_traits<cb_details::allocator_traits<Alloc> > > iterator;
+    typedef cb_details::iterator< circular_buffer<T, Alloc>, cb_details::nonconst_traits<Alloc> > iterator;
 
     //! A const iterator used to iterate backwards through a <code>circular_buffer</code>.
     typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
@@ -287,6 +287,7 @@ public:
     */
     const_iterator begin() const BOOST_NOEXCEPT { return const_iterator(this, empty() ? 0 : m_first); }
 
+    const_iterator cbegin() const BOOST_NOEXCEPT { return begin(); }
     //! Get the const iterator pointing to the end of the <code>circular_buffer</code>.
     /*!
         \return A const random access iterator pointing to the element "one behind" the last element of the <code>
@@ -303,6 +304,7 @@ public:
     */
     const_iterator end() const BOOST_NOEXCEPT { return const_iterator(this, 0); }
 
+    const_iterator cend() const BOOST_NOEXCEPT { return end(); }
     //! Get the iterator pointing to the beginning of the "reversed" <code>circular_buffer</code>.
     /*!
         \return A reverse random access iterator pointing to the last element of the <code>circular_buffer</code>.
@@ -666,7 +668,7 @@ public:
                         break;
                     }
                     if (is_uninitialized(dest)) {
-                        cb_details::allocator_traits<Alloc>::construct(alloc(), boost::to_address(dest), boost::move_if_noexcept(*src));
+                        boost::allocator_construct(alloc(), boost::to_address(dest), boost::move_if_noexcept(*src));
                         ++constructed;
                     } else {
                         value_type tmp = boost::move_if_noexcept(*src); 
@@ -787,7 +789,7 @@ public:
         \sa <code>size()</code>, <code>capacity()</code>, <code>reserve()</code>
     */
     size_type max_size() const BOOST_NOEXCEPT {
-        return (std::min<size_type>)(cb_details::allocator_traits<Alloc>::max_size(alloc()), (std::numeric_limits<difference_type>::max)());
+        return (std::min<size_type>)(boost::allocator_max_size(alloc()), (std::numeric_limits<difference_type>::max)());
     }
 
     //! Is the <code>circular_buffer</code> empty?
@@ -1424,7 +1426,7 @@ private:
             increment(m_last);
             m_first = m_last;
         } else {
-            cb_details::allocator_traits<Alloc>::construct(alloc(), boost::to_address(m_last), static_cast<ValT>(item));
+            boost::allocator_construct(alloc(), boost::to_address(m_last), static_cast<ValT>(item));
             increment(m_last);
             ++m_size;
         }        
@@ -1442,7 +1444,7 @@ private:
                 m_last = m_first;
             } else {
                 decrement(m_first);
-                cb_details::allocator_traits<Alloc>::construct(alloc(), boost::to_address(m_first), static_cast<ValT>(item));
+                boost::allocator_construct(alloc(), boost::to_address(m_first), static_cast<ValT>(item));
                 ++m_size;
             }
         } BOOST_CATCH(...) {
@@ -2427,7 +2429,7 @@ private:
     /*! INTERNAL ONLY */
     void construct_or_replace(bool construct, pointer pos, param_value_type item) {
         if (construct)
-            cb_details::allocator_traits<Alloc>::construct(alloc(), boost::to_address(pos), item);
+            boost::allocator_construct(alloc(), boost::to_address(pos), item);
         else
             replace(pos, item);
     }
@@ -2435,14 +2437,14 @@ private:
     /*! INTERNAL ONLY */
     void construct_or_replace(bool construct, pointer pos, rvalue_type item) {
         if (construct)
-            cb_details::allocator_traits<Alloc>::construct(alloc(), boost::to_address(pos), boost::move(item));
+            boost::allocator_construct(alloc(), boost::to_address(pos), boost::move(item));
         else
             replace(pos, boost::move(item));
     }
 
     /*! INTERNAL ONLY */
     void destroy_item(pointer p) {
-        cb_details::allocator_traits<Alloc>::destroy(alloc(), boost::to_address(p));
+        boost::allocator_destroy(alloc(), boost::to_address(p));
 #if BOOST_CB_ENABLE_DEBUG
         invalidate_iterators(iterator(this, p));
         cb_details::do_fill_uninitialized_memory(p, sizeof(value_type));
@@ -2517,7 +2519,7 @@ private:
     template <class Iterator>
     void initialize(Iterator first, Iterator last, const false_type&) {
         BOOST_CB_IS_CONVERTIBLE(Iterator, value_type); // check for invalid iterator type
-#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x581))
+#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x581))
         initialize(first, last, std::iterator_traits<Iterator>::iterator_category());
 #else
         initialize(first, last, BOOST_DEDUCED_TYPENAME std::iterator_traits<Iterator>::iterator_category());
@@ -2556,7 +2558,7 @@ private:
     template <class Iterator>
     void initialize(capacity_type buffer_capacity, Iterator first, Iterator last, const false_type&) {
         BOOST_CB_IS_CONVERTIBLE(Iterator, value_type); // check for invalid iterator type
-#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x581))
+#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x581))
         initialize(buffer_capacity, first, last, std::iterator_traits<Iterator>::iterator_category());
 #else
         initialize(buffer_capacity, first, last, BOOST_DEDUCED_TYPENAME std::iterator_traits<Iterator>::iterator_category());
@@ -2575,7 +2577,7 @@ private:
         if (buffer_capacity == 0)
             return;
         while (first != last && !full()) {
-            cb_details::allocator_traits<Alloc>::construct(alloc(), boost::to_address(m_last), *first++);
+            boost::allocator_construct(alloc(), boost::to_address(m_last), *first++);
             increment(m_last);
             ++m_size;
         }
@@ -2650,7 +2652,7 @@ private:
     template <class Iterator>
     void assign(Iterator first, Iterator last, const false_type&) {
         BOOST_CB_IS_CONVERTIBLE(Iterator, value_type); // check for invalid iterator type
-#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x581))
+#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x581))
         assign(first, last, std::iterator_traits<Iterator>::iterator_category());
 #else
         assign(first, last, BOOST_DEDUCED_TYPENAME std::iterator_traits<Iterator>::iterator_category());
@@ -2687,7 +2689,7 @@ private:
     template <class Iterator>
     void assign(capacity_type new_capacity, Iterator first, Iterator last, const false_type&) {
         BOOST_CB_IS_CONVERTIBLE(Iterator, value_type); // check for invalid iterator type
-#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x581))
+#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x581))
         assign(new_capacity, first, last, std::iterator_traits<Iterator>::iterator_category());
 #else
         assign(new_capacity, first, last, BOOST_DEDUCED_TYPENAME std::iterator_traits<Iterator>::iterator_category());
@@ -2796,7 +2798,7 @@ private:
     template <class Iterator>
     void insert(const iterator& pos, Iterator first, Iterator last, const false_type&) {
         BOOST_CB_IS_CONVERTIBLE(Iterator, value_type); // check for invalid iterator type
-#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x581))
+#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x581))
         insert(pos, first, last, std::iterator_traits<Iterator>::iterator_category());
 #else
         insert(pos, first, last, BOOST_DEDUCED_TYPENAME std::iterator_traits<Iterator>::iterator_category());
@@ -2840,7 +2842,7 @@ private:
             pointer p = m_last;
             BOOST_TRY {
                 for (; ii < construct; ++ii, increment(p))
-                    cb_details::allocator_traits<Alloc>::construct(alloc(), boost::to_address(p), *wrapper());
+                    boost::allocator_construct(alloc(), boost::to_address(p), *wrapper());
                 for (;ii < n; ++ii, increment(p))
                     replace(p, *wrapper());
             } BOOST_CATCH(...) {
@@ -2887,7 +2889,7 @@ private:
     template <class Iterator>
     void rinsert(const iterator& pos, Iterator first, Iterator last, const false_type&) {
         BOOST_CB_IS_CONVERTIBLE(Iterator, value_type); // check for invalid iterator type
-#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x581))
+#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x581))
         rinsert(pos, first, last, std::iterator_traits<Iterator>::iterator_category());
 #else
         rinsert(pos, first, last, BOOST_DEDUCED_TYPENAME std::iterator_traits<Iterator>::iterator_category());
@@ -2934,7 +2936,7 @@ private:
                 for (;ii > construct; --ii, increment(p))
                     replace(p, *wrapper());
                 for (; ii > 0; --ii, increment(p))
-                    cb_details::allocator_traits<Alloc>::construct(alloc(), boost::to_address(p), *wrapper());
+                    boost::allocator_construct(alloc(), boost::to_address(p), *wrapper());
             } BOOST_CATCH(...) {
                 size_type constructed = ii < construct ? construct - ii : 0;
                 m_last = add(m_last, constructed);