1 //////////////////////////////////////////////////////////////////////////////
2 //
3 // (C) Copyright Ion Gaztanaga 2014-2014.
4 //
5 // Distributed under the Boost Software License, Version 1.0.
6 // (See accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt)
8 //
9 // See http://www.boost.org/libs/container for documentation.
10 //
11 //////////////////////////////////////////////////////////////////////////////
12 
13 #ifndef BOOST_CONTAINER_DETAIL_ITERATOR_HPP
14 #define BOOST_CONTAINER_DETAIL_ITERATOR_HPP
15 
16 #ifndef BOOST_CONFIG_HPP
17 #  include <boost/config.hpp>
18 #endif
19 
20 #if defined(BOOST_HAS_PRAGMA_ONCE)
21 #  pragma once
22 #endif
23 
24 #include <boost/intrusive/detail/iterator.hpp>
25 #include <boost/move/utility_core.hpp>
26 #include <boost/container/detail/mpl.hpp>
27 
28 namespace boost {
29 namespace container {
30 
31 using ::boost::intrusive::iterator_traits;
32 using ::boost::intrusive::iterator_distance;
33 using ::boost::intrusive::iterator_advance;
34 using ::boost::intrusive::iterator;
35 using ::boost::intrusive::iterator_enable_if_tag;
36 using ::boost::intrusive::iterator_disable_if_tag;
37 using ::boost::intrusive::iterator_arrow_result;
38 
39 template <class Container>
40 class back_emplacer
41 {
42    private:
43    Container& container;
44 
45    public:
46    typedef std::output_iterator_tag iterator_category;
47    typedef void                     value_type;
48    typedef void                     difference_type;
49    typedef void                     pointer;
50    typedef void                     reference;
51 
back_emplacer(Container & x)52    back_emplacer(Container& x)
53       : container(x)
54    {}
55 
56    template<class U>
operator =(BOOST_FWD_REF (U)value)57    back_emplacer& operator=(BOOST_FWD_REF(U) value)
58    {
59       container.emplace_back(boost::forward<U>(value));
60       return *this;
61    }
operator *()62    back_emplacer& operator*()    { return *this; }
operator ++()63    back_emplacer& operator++()   { return *this; }
operator ++(int)64    back_emplacer& operator++(int){ return *this; }
65 };
66 
67 #ifndef BOOST_CONTAINER_NO_CXX17_CTAD
68 
69 template<class InputIterator>
70 using it_based_non_const_first_type_t = typename dtl::remove_const<typename iterator_traits<InputIterator>::value_type::first_type>::type;
71 
72 template<class InputIterator>
73 using it_based_const_first_type_t = const typename dtl::remove_const<typename iterator_traits<InputIterator>::value_type::first_type>::type;
74 
75 template<class InputIterator>
76 using it_based_second_type_t = typename iterator_traits<InputIterator>::value_type::second_type;
77 
78 template<class InputIterator>
79 using it_based_value_type_t = typename iterator_traits<InputIterator>::value_type;
80 
81 #endif
82 
83 }  //namespace container {
84 }  //namespace boost {
85 
86 #endif   //#ifndef BOOST_CONTAINER_DETAIL_ITERATORS_HPP
87