_raw_storage_iter.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /*
  2. *
  3. * Copyright (c) 1994
  4. * Hewlett-Packard Company
  5. *
  6. * Copyright (c) 1996,1997
  7. * Silicon Graphics Computer Systems, Inc.
  8. *
  9. * Copyright (c) 1997
  10. * Moscow Center for SPARC Technology
  11. *
  12. * Copyright (c) 1999
  13. * Boris Fomitchev
  14. *
  15. * This material is provided "as is", with absolutely no warranty expressed
  16. * or implied. Any use is at your own risk.
  17. *
  18. * Permission to use or copy this software for any purpose is hereby granted
  19. * without fee, provided the above notices are retained on all copies.
  20. * Permission to modify the code and to distribute modified code is granted,
  21. * provided the above notices are retained, and a notice that the code was
  22. * modified is included with the above copyright notice.
  23. *
  24. */
  25. /* NOTE: This is an internal header file, included by other STL headers.
  26. * You should not attempt to use it directly.
  27. */
  28. #ifndef _STLP_INTERNAL_RAW_STORAGE_ITERATOR_H
  29. #define _STLP_INTERNAL_RAW_STORAGE_ITERATOR_H
  30. #ifndef _STLP_INTERNAL_ITERATOR_BASE_H
  31. # include <stl/_iterator_base.h>
  32. #endif
  33. _STLP_BEGIN_NAMESPACE
  34. template <class _ForwardIterator, class _Tp>
  35. class raw_storage_iterator
  36. : public iterator<output_iterator_tag,void,void,void,void>
  37. {
  38. protected:
  39. _ForwardIterator _M_iter;
  40. public:
  41. typedef output_iterator_tag iterator_category;
  42. # ifdef _STLP_CLASS_PARTIAL_SPECIALIZATION
  43. typedef void value_type;
  44. typedef void difference_type;
  45. typedef void pointer;
  46. typedef void reference;
  47. # endif
  48. explicit raw_storage_iterator(_ForwardIterator __x) : _M_iter(__x) {}
  49. raw_storage_iterator<_ForwardIterator, _Tp>& operator*() { return *this; }
  50. raw_storage_iterator<_ForwardIterator, _Tp>& operator=(const _Tp& __element) {
  51. _Param_Construct(&*_M_iter, __element);
  52. return *this;
  53. }
  54. raw_storage_iterator<_ForwardIterator, _Tp>& operator++() {
  55. ++_M_iter;
  56. return *this;
  57. }
  58. raw_storage_iterator<_ForwardIterator, _Tp> operator++(int) {
  59. raw_storage_iterator<_ForwardIterator, _Tp> __tmp = *this;
  60. ++_M_iter;
  61. return __tmp;
  62. }
  63. };
  64. # ifdef _STLP_USE_OLD_HP_ITERATOR_QUERIES
  65. template <class _ForwardIterator, class _Tp>
  66. inline output_iterator_tag iterator_category(const raw_storage_iterator<_ForwardIterator, _Tp>&) { return output_iterator_tag(); }
  67. #endif
  68. _STLP_END_NAMESPACE
  69. #endif /* _STLP_INTERNAL_RAW_STORAGE_ITERATOR_H */
  70. // Local Variables:
  71. // mode:C++
  72. // End: