/src/contrib/boost/mpl/zip_view.hpp

http://pythonocc.googlecode.com/ · C++ Header · 65 lines · 42 code · 12 blank · 11 comment · 0 complexity · c8ee90b35ac0658285385523256dce2f MD5 · raw file

  1. #ifndef BOOST_MPL_ZIP_VIEW_HPP_INCLUDED
  2. #define BOOST_MPL_ZIP_VIEW_HPP_INCLUDED
  3. // Copyright Aleksey Gurtovoy 2000-2010
  4. // Copyright David Abrahams 2000-2002
  5. //
  6. // Distributed under the Boost Software License, Version 1.0.
  7. // (See accompanying file LICENSE_1_0.txt or copy at
  8. // http://www.boost.org/LICENSE_1_0.txt)
  9. //
  10. // See http://www.boost.org/libs/mpl for documentation.
  11. // $Id: zip_view.hpp 61591 2010-04-26 21:31:09Z agurtovoy $
  12. // $Date: 2010-04-26 17:31:09 -0400 (Mon, 26 Apr 2010) $
  13. // $Revision: 61591 $
  14. #include <boost/mpl/transform.hpp>
  15. #include <boost/mpl/begin_end.hpp>
  16. #include <boost/mpl/iterator_tags.hpp>
  17. #include <boost/mpl/next.hpp>
  18. #include <boost/mpl/lambda.hpp>
  19. #include <boost/mpl/deref.hpp>
  20. #include <boost/mpl/aux_/na_spec.hpp>
  21. namespace boost { namespace mpl {
  22. template< typename IteratorSeq >
  23. struct zip_iterator
  24. {
  25. typedef forward_iterator_tag category;
  26. typedef typename transform1<
  27. IteratorSeq
  28. , deref<_1>
  29. >::type type;
  30. typedef zip_iterator<
  31. typename transform1<
  32. IteratorSeq
  33. , mpl::next<_1>
  34. >::type
  35. > next;
  36. };
  37. template<
  38. typename BOOST_MPL_AUX_NA_PARAM(Sequences)
  39. >
  40. struct zip_view
  41. {
  42. private:
  43. typedef typename transform1< Sequences, mpl::begin<_1> >::type first_ones_;
  44. typedef typename transform1< Sequences, mpl::end<_1> >::type last_ones_;
  45. public:
  46. typedef nested_begin_end_tag tag;
  47. typedef zip_view type;
  48. typedef zip_iterator<first_ones_> begin;
  49. typedef zip_iterator<last_ones_> end;
  50. };
  51. BOOST_MPL_AUX_NA_SPEC(1, zip_view)
  52. }}
  53. #endif // BOOST_MPL_ZIP_VIEW_HPP_INCLUDED