diff DEPENDENCIES/generic/include/boost/container/detail/iterators.hpp @ 101:c530137014c0

Update Boost headers (1.58.0)
author Chris Cannam
date Mon, 07 Sep 2015 11:12:49 +0100
parents 2665513ce2d3
children
line wrap: on
line diff
--- a/DEPENDENCIES/generic/include/boost/container/detail/iterators.hpp	Fri Sep 04 12:01:02 2015 +0100
+++ b/DEPENDENCIES/generic/include/boost/container/detail/iterators.hpp	Mon Sep 07 11:12:49 2015 +0100
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2012.
+// (C) Copyright Ion Gaztanaga 2005-2013.
 // (C) Copyright Gennaro Prota 2003 - 2004.
 //
 // Distributed under the Boost Software License, Version 1.0.
@@ -14,31 +14,35 @@
 #ifndef BOOST_CONTAINER_DETAIL_ITERATORS_HPP
 #define BOOST_CONTAINER_DETAIL_ITERATORS_HPP
 
-#if defined(_MSC_VER)
+#ifndef BOOST_CONFIG_HPP
+#  include <boost/config.hpp>
+#endif
+
+#if defined(BOOST_HAS_PRAGMA_ONCE)
 #  pragma once
 #endif
 
-#include "config_begin.hpp"
+#include <boost/container/detail/config_begin.hpp>
 #include <boost/container/detail/workaround.hpp>
-#include <boost/move/utility.hpp>
 #include <boost/container/allocator_traits.hpp>
 #include <boost/container/detail/type_traits.hpp>
 #include <boost/static_assert.hpp>
+#include <boost/move/utility_core.hpp>
+#include <boost/intrusive/detail/reverse_iterator.hpp>
 
-#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
+#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
+#include <boost/move/detail/fwd_macros.hpp>
+#else
 #include <boost/container/detail/variadic_templates_tools.hpp>
-#else
-#include <boost/container/detail/preprocessor.hpp>
 #endif
-
-#include <iterator>
+#include <boost/container/detail/iterator.hpp>
 
 namespace boost {
 namespace container {
 
 template <class T, class Difference = std::ptrdiff_t>
 class constant_iterator
-  : public std::iterator
+  : public ::boost::container::iterator
       <std::random_access_iterator_tag, T, Difference, const T*, const T &>
 {
    typedef  constant_iterator<T, Difference> this_type;
@@ -53,7 +57,7 @@
 
    constant_iterator& operator++()
    { increment();   return *this;   }
-  
+
    constant_iterator operator++(int)
    {
       constant_iterator result (*this);
@@ -63,7 +67,7 @@
 
    constant_iterator& operator--()
    { decrement();   return *this;   }
-  
+
    constant_iterator operator--(int)
    {
       constant_iterator result (*this);
@@ -147,9 +151,9 @@
    {  return m_num - other.m_num;   }
 };
 
-template <class T, class Difference = std::ptrdiff_t>
+template <class T, class Difference>
 class value_init_construct_iterator
-  : public std::iterator
+  : public ::boost::container::iterator
       <std::random_access_iterator_tag, T, Difference, const T*, const T &>
 {
    typedef  value_init_construct_iterator<T, Difference> this_type;
@@ -164,7 +168,7 @@
 
    value_init_construct_iterator& operator++()
    { increment();   return *this;   }
-  
+
    value_init_construct_iterator operator++(int)
    {
       value_init_construct_iterator result (*this);
@@ -174,7 +178,7 @@
 
    value_init_construct_iterator& operator--()
    { decrement();   return *this;   }
-  
+
    value_init_construct_iterator operator--(int)
    {
       value_init_construct_iterator result (*this);
@@ -258,9 +262,9 @@
    {  return m_num - other.m_num;   }
 };
 
-template <class T, class Difference = std::ptrdiff_t>
+template <class T, class Difference>
 class default_init_construct_iterator
-  : public std::iterator
+  : public ::boost::container::iterator
       <std::random_access_iterator_tag, T, Difference, const T*, const T &>
 {
    typedef  default_init_construct_iterator<T, Difference> this_type;
@@ -275,7 +279,7 @@
 
    default_init_construct_iterator& operator++()
    { increment();   return *this;   }
-  
+
    default_init_construct_iterator operator++(int)
    {
       default_init_construct_iterator result (*this);
@@ -285,7 +289,7 @@
 
    default_init_construct_iterator& operator--()
    { decrement();   return *this;   }
-  
+
    default_init_construct_iterator operator--(int)
    {
       default_init_construct_iterator result (*this);
@@ -372,7 +376,7 @@
 
 template <class T, class Difference = std::ptrdiff_t>
 class repeat_iterator
-  : public std::iterator
+  : public ::boost::container::iterator
       <std::random_access_iterator_tag, T, Difference>
 {
    typedef repeat_iterator<T, Difference> this_type;
@@ -386,7 +390,7 @@
 
    this_type& operator++()
    { increment();   return *this;   }
-  
+
    this_type operator++(int)
    {
       this_type result (*this);
@@ -396,7 +400,7 @@
 
    this_type& operator--()
    { increment();   return *this;   }
-  
+
    this_type operator--(int)
    {
       this_type result (*this);
@@ -482,7 +486,7 @@
 
 template <class T, class EmplaceFunctor, class Difference /*= std::ptrdiff_t*/>
 class emplace_iterator
-  : public std::iterator
+  : public ::boost::container::iterator
       <std::random_access_iterator_tag, T, Difference, const T*, const T &>
 {
    typedef emplace_iterator this_type;
@@ -497,7 +501,7 @@
 
    this_type& operator++()
    { increment();   return *this;   }
-  
+
    this_type operator++(int)
    {
       this_type result (*this);
@@ -507,7 +511,7 @@
 
    this_type& operator--()
    { decrement();   return *this;   }
-  
+
    this_type operator--(int)
    {
       this_type result (*this);
@@ -563,8 +567,8 @@
    //const T& operator[](difference_type) const;
    //const T* operator->() const;
 
-   template<class A>
-   void construct_in_place(A &a, T* ptr)
+   template<class Allocator>
+   void construct_in_place(Allocator &a, T* ptr)
    {  (*m_pe)(a, ptr);  }
 
    private:
@@ -596,54 +600,49 @@
    {  return difference_type(m_num - other.m_num);   }
 };
 
-#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
+#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
 
 template<class ...Args>
 struct emplace_functor
 {
    typedef typename container_detail::build_number_seq<sizeof...(Args)>::type index_tuple_t;
 
-   emplace_functor(Args&&... args)
+   emplace_functor(BOOST_FWD_REF(Args)... args)
       : args_(args...)
    {}
 
-   template<class A, class T>
-   void operator()(A &a, T *ptr)
+   template<class Allocator, class T>
+   void operator()(Allocator &a, T *ptr)
    {  emplace_functor::inplace_impl(a, ptr, index_tuple_t());  }
 
-   template<class A, class T, int ...IdxPack>
-   void inplace_impl(A &a, T* ptr, const container_detail::index_tuple<IdxPack...>&)
+   template<class Allocator, class T, int ...IdxPack>
+   void inplace_impl(Allocator &a, T* ptr, const container_detail::index_tuple<IdxPack...>&)
    {
-      allocator_traits<A>::construct
+      allocator_traits<Allocator>::construct
          (a, ptr, ::boost::forward<Args>(container_detail::get<IdxPack>(args_))...);
    }
 
    container_detail::tuple<Args&...> args_;
 };
 
-#else //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
+#else // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
 
-#define BOOST_PP_LOCAL_MACRO(n)                                                        \
-   BOOST_PP_EXPR_IF(n, template <)                                                     \
-      BOOST_PP_ENUM_PARAMS(n, class P)                                                 \
-         BOOST_PP_EXPR_IF(n, >)                                                        \
-   struct BOOST_PP_CAT(BOOST_PP_CAT(emplace_functor, n), arg)                          \
-   {                                                                                   \
-      BOOST_PP_CAT(BOOST_PP_CAT(emplace_functor, n), arg)                              \
-         ( BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _) )                        \
-      BOOST_PP_EXPR_IF(n, :) BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_INIT, _){}      \
-                                                                                       \
-      template<class A, class T>                                                       \
-      void operator()(A &a, T *ptr)                                                    \
-      {                                                                                \
-         allocator_traits<A>::construct                                                \
-            (a, ptr BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_MEMBER_FORWARD, _) ); \
-      }                                                                                \
-      BOOST_PP_REPEAT(n, BOOST_CONTAINER_PP_PARAM_DEFINE, _)                           \
-   };                                                                                  \
-   //!
-#define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
-#include BOOST_PP_LOCAL_ITERATE()
+#define BOOST_MOVE_ITERATOR_EMPLACE_FUNCTOR_CODE(N) \
+BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \
+struct emplace_functor##N\
+{\
+   explicit emplace_functor##N( BOOST_MOVE_UREF##N )\
+      BOOST_MOVE_COLON##N BOOST_MOVE_FWD_INIT##N{}\
+   \
+   template<class Allocator, class T>\
+   void operator()(Allocator &a, T *ptr)\
+   {  allocator_traits<Allocator>::construct(a, ptr BOOST_MOVE_I##N BOOST_MOVE_MFWD##N);  }\
+   \
+   BOOST_MOVE_MREF##N\
+};\
+//
+BOOST_MOVE_ITERATE_0TO9(BOOST_MOVE_ITERATOR_EMPLACE_FUNCTOR_CODE)
+#undef BOOST_MOVE_ITERATOR_EMPLACE_FUNCTOR_CODE
 
 #endif
 
@@ -698,13 +697,18 @@
    static const bool value = false;
 };
 
+template<class IINodeType>
+struct iiterator_node_value_type {
+  typedef typename IINodeType::value_type type;
+};
+
 template<class IIterator>
 struct iiterator_types
 {
    typedef typename IIterator::value_type                            it_value_type;
-   typedef typename it_value_type::value_type                        value_type;
-   typedef typename std::iterator_traits<IIterator>::pointer         it_pointer;
-   typedef typename std::iterator_traits<IIterator>::difference_type difference_type;
+   typedef typename iiterator_node_value_type<it_value_type>::type   value_type;
+   typedef typename boost::container::iterator_traits<IIterator>::pointer         it_pointer;
+   typedef typename boost::container::iterator_traits<IIterator>::difference_type difference_type;
    typedef typename ::boost::intrusive::pointer_traits<it_pointer>::
       template rebind_pointer<value_type>::type                      pointer;
    typedef typename ::boost::intrusive::pointer_traits<it_pointer>::
@@ -717,9 +721,9 @@
 };
 
 template<class IIterator, bool IsConst>
-struct std_iterator
+struct iterator_types
 {
-   typedef typename std::iterator
+   typedef typename ::boost::container::iterator
       < typename iiterator_types<IIterator>::iterator_category
       , typename iiterator_types<IIterator>::value_type
       , typename iiterator_types<IIterator>::difference_type
@@ -728,9 +732,9 @@
 };
 
 template<class IIterator>
-struct std_iterator<IIterator, false>
+struct iterator_types<IIterator, false>
 {
-   typedef typename std::iterator
+   typedef typename ::boost::container::iterator
       < typename iiterator_types<IIterator>::iterator_category
       , typename iiterator_types<IIterator>::value_type
       , typename iiterator_types<IIterator>::difference_type
@@ -739,64 +743,65 @@
 };
 
 template<class IIterator, bool IsConst>
-class iterator
-   :  public std_iterator<IIterator, IsConst>::type
+class iterator_from_iiterator
 {
-   typedef typename std_iterator<IIterator, IsConst>::type types_t;
+   typedef typename iterator_types<IIterator, IsConst>::type types_t;
 
    public:
-   typedef typename types_t::value_type      value_type;
-   typedef typename types_t::pointer         pointer;
-   typedef typename types_t::reference       reference;
+   typedef typename types_t::pointer             pointer;
+   typedef typename types_t::reference           reference;
+   typedef typename types_t::difference_type     difference_type;
+   typedef typename types_t::iterator_category   iterator_category;
+   typedef typename types_t::value_type          value_type;
 
-   iterator()
+   iterator_from_iiterator()
    {}
 
-   explicit iterator(IIterator iit) BOOST_CONTAINER_NOEXCEPT
+   explicit iterator_from_iiterator(IIterator iit) BOOST_NOEXCEPT_OR_NOTHROW
       : m_iit(iit)
    {}
 
-   iterator(iterator<IIterator, false> const& other) BOOST_CONTAINER_NOEXCEPT
+   iterator_from_iiterator(iterator_from_iiterator<IIterator, false> const& other) BOOST_NOEXCEPT_OR_NOTHROW
       :  m_iit(other.get())
    {}
 
-   iterator& operator++() BOOST_CONTAINER_NOEXCEPT
+   iterator_from_iiterator& operator++() BOOST_NOEXCEPT_OR_NOTHROW
    {  ++this->m_iit;   return *this;  }
 
-   iterator operator++(int) BOOST_CONTAINER_NOEXCEPT
+   iterator_from_iiterator operator++(int) BOOST_NOEXCEPT_OR_NOTHROW
    {
-      iterator result (*this);
+      iterator_from_iiterator result (*this);
       ++this->m_iit;
       return result;
    }
 
-   iterator& operator--() BOOST_CONTAINER_NOEXCEPT
+   iterator_from_iiterator& operator--() BOOST_NOEXCEPT_OR_NOTHROW
    {
-      //If the iterator is not a bidirectional iterator, operator-- should not exist
-      BOOST_STATIC_ASSERT((is_bidirectional_iterator<iterator>::value));
+      //If the iterator_from_iiterator is not a bidirectional iterator, operator-- should not exist
+      BOOST_STATIC_ASSERT((is_bidirectional_iterator<iterator_from_iiterator>::value));
       --this->m_iit;   return *this;
    }
 
-   iterator operator--(int) BOOST_CONTAINER_NOEXCEPT
+   iterator_from_iiterator operator--(int) BOOST_NOEXCEPT_OR_NOTHROW
    {
-      iterator result (*this);
+      iterator_from_iiterator result (*this);
       --this->m_iit;
       return result;
    }
 
-   friend bool operator== (const iterator& l, const iterator& r) BOOST_CONTAINER_NOEXCEPT
+   friend bool operator== (const iterator_from_iiterator& l, const iterator_from_iiterator& r) BOOST_NOEXCEPT_OR_NOTHROW
    {  return l.m_iit == r.m_iit;   }
 
-   friend bool operator!= (const iterator& l, const iterator& r) BOOST_CONTAINER_NOEXCEPT
+   friend bool operator!= (const iterator_from_iiterator& l, const iterator_from_iiterator& r) BOOST_NOEXCEPT_OR_NOTHROW
    {  return !(l == r); }
 
-   reference operator*()  const BOOST_CONTAINER_NOEXCEPT
+   reference operator*()  const BOOST_NOEXCEPT_OR_NOTHROW
    {  return (*this->m_iit).get_data();  }
 
-   pointer   operator->() const BOOST_CONTAINER_NOEXCEPT
+   pointer   operator->() const BOOST_NOEXCEPT_OR_NOTHROW
    {  return ::boost::intrusive::pointer_traits<pointer>::pointer_to(this->operator*());  }
 
-   const IIterator &get() const BOOST_CONTAINER_NOEXCEPT
+   const IIterator &get() const BOOST_NOEXCEPT_OR_NOTHROW
    {  return this->m_iit;   }
 
    private:
@@ -804,6 +809,9 @@
 };
 
 }  //namespace container_detail {
+
+using ::boost::intrusive::reverse_iterator;
+
 }  //namespace container {
 }  //namespace boost {