iterator.hpp 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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. #ifndef BOOST_CONTAINER_DETAIL_ITERATOR_HPP
  13. #define BOOST_CONTAINER_DETAIL_ITERATOR_HPP
  14. #ifndef BOOST_CONFIG_HPP
  15. # include <boost/config.hpp>
  16. #endif
  17. #if defined(BOOST_HAS_PRAGMA_ONCE)
  18. # pragma once
  19. #endif
  20. #include <boost/intrusive/detail/iterator.hpp>
  21. #include <boost/move/utility_core.hpp>
  22. #include <boost/container/detail/mpl.hpp>
  23. namespace boost {
  24. namespace container {
  25. using ::boost::intrusive::iterator_traits;
  26. using ::boost::intrusive::iterator_distance;
  27. using ::boost::intrusive::iterator_advance;
  28. using ::boost::intrusive::iterator;
  29. using ::boost::intrusive::iterator_enable_if_tag;
  30. using ::boost::intrusive::iterator_disable_if_tag;
  31. using ::boost::intrusive::iterator_arrow_result;
  32. template <class Container>
  33. class back_emplacer
  34. {
  35. private:
  36. Container& container;
  37. public:
  38. typedef std::output_iterator_tag iterator_category;
  39. typedef void value_type;
  40. typedef void difference_type;
  41. typedef void pointer;
  42. typedef void reference;
  43. back_emplacer(Container& x)
  44. : container(x)
  45. {}
  46. template<class U>
  47. back_emplacer& operator=(BOOST_FWD_REF(U) value)
  48. {
  49. container.emplace_back(boost::forward<U>(value));
  50. return *this;
  51. }
  52. back_emplacer& operator*() { return *this; }
  53. back_emplacer& operator++() { return *this; }
  54. back_emplacer& operator++(int){ return *this; }
  55. };
  56. #ifndef BOOST_CONTAINER_NO_CXX17_CTAD
  57. template<class InputIterator>
  58. using it_based_non_const_first_type_t = typename dtl::remove_const<typename iterator_traits<InputIterator>::value_type::first_type>::type;
  59. template<class InputIterator>
  60. using it_based_const_first_type_t = const typename dtl::remove_const<typename iterator_traits<InputIterator>::value_type::first_type>::type;
  61. template<class InputIterator>
  62. using it_based_second_type_t = typename iterator_traits<InputIterator>::value_type::second_type;
  63. template<class InputIterator>
  64. using it_based_value_type_t = typename iterator_traits<InputIterator>::value_type;
  65. #endif
  66. } //namespace container {
  67. } //namespace boost {
  68. #endif //#ifndef BOOST_CONTAINER_DETAIL_ITERATORS_HPP