iterator.hpp 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #ifndef BOOST_MPL_LIST_AUX_ITERATOR_HPP_INCLUDED
  2. #define BOOST_MPL_LIST_AUX_ITERATOR_HPP_INCLUDED
  3. // Copyright Aleksey Gurtovoy 2000-2004
  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/mpl for documentation.
  10. // $Id$
  11. // $Date$
  12. // $Revision$
  13. #include <boost/mpl/iterator_tags.hpp>
  14. #include <boost/mpl/next_prior.hpp>
  15. #include <boost/mpl/deref.hpp>
  16. #include <boost/mpl/list/aux_/item.hpp>
  17. #include <boost/mpl/aux_/na.hpp>
  18. #include <boost/mpl/aux_/lambda_spec.hpp>
  19. #include <boost/mpl/aux_/config/ctps.hpp>
  20. namespace boost { namespace mpl {
  21. #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
  22. template< typename Node >
  23. struct l_iter
  24. {
  25. typedef aux::l_iter_tag tag;
  26. typedef forward_iterator_tag category;
  27. };
  28. template< typename Node >
  29. struct deref< l_iter<Node> >
  30. {
  31. typedef typename Node::item type;
  32. };
  33. template< typename Node >
  34. struct next< l_iter<Node> >
  35. {
  36. typedef l_iter< typename Node::next > type;
  37. };
  38. #else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
  39. template< typename Node >
  40. struct l_iter
  41. {
  42. typedef aux::l_iter_tag tag;
  43. typedef forward_iterator_tag category;
  44. typedef typename Node::item type;
  45. typedef l_iter< typename mpl::next<Node>::type > next;
  46. };
  47. #endif
  48. template<> struct l_iter<l_end>
  49. {
  50. typedef aux::l_iter_tag tag;
  51. typedef forward_iterator_tag category;
  52. #if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
  53. typedef na type;
  54. typedef l_iter next;
  55. #endif
  56. };
  57. BOOST_MPL_AUX_PASS_THROUGH_LAMBDA_SPEC(1, l_iter)
  58. }}
  59. #endif // BOOST_MPL_LIST_AUX_ITERATOR_HPP_INCLUDED