iterator.hpp 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. namespace boost {
  23. namespace container {
  24. using ::boost::intrusive::iterator_traits;
  25. using ::boost::intrusive::iterator_distance;
  26. using ::boost::intrusive::iterator_advance;
  27. using ::boost::intrusive::iterator;
  28. using ::boost::intrusive::iterator_enable_if_tag;
  29. using ::boost::intrusive::iterator_disable_if_tag;
  30. using ::boost::intrusive::iterator_arrow_result;
  31. template <class Container>
  32. class back_emplacer
  33. {
  34. private:
  35. Container& container;
  36. public:
  37. typedef std::output_iterator_tag iterator_category;
  38. typedef void value_type;
  39. typedef void difference_type;
  40. typedef void pointer;
  41. typedef void reference;
  42. back_emplacer(Container& x)
  43. : container(x)
  44. {}
  45. template<class U>
  46. back_emplacer& operator=(BOOST_FWD_REF(U) value)
  47. {
  48. container.emplace_back(boost::forward<U>(value));
  49. return *this;
  50. }
  51. back_emplacer& operator*() { return *this; }
  52. back_emplacer& operator++() { return *this; }
  53. back_emplacer& operator++(int){ return *this; }
  54. };
  55. } //namespace container {
  56. } //namespace boost {
  57. #endif //#ifndef BOOST_CONTAINER_DETAIL_ITERATORS_HPP