joint_view.hpp 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #ifndef BOOST_MPL_JOINT_VIEW_HPP_INCLUDED
  2. #define BOOST_MPL_JOINT_VIEW_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/aux_/joint_iter.hpp>
  14. #include <boost/mpl/plus.hpp>
  15. #include <boost/mpl/size_fwd.hpp>
  16. #include <boost/mpl/begin_end.hpp>
  17. #include <boost/mpl/aux_/na_spec.hpp>
  18. namespace boost { namespace mpl {
  19. namespace aux {
  20. struct joint_view_tag;
  21. }
  22. template<>
  23. struct size_impl< aux::joint_view_tag >
  24. {
  25. template < typename JointView > struct apply
  26. : plus<
  27. size<typename JointView::sequence1_>
  28. , size<typename JointView::sequence2_>
  29. >
  30. {};
  31. };
  32. template<
  33. typename BOOST_MPL_AUX_NA_PARAM(Sequence1_)
  34. , typename BOOST_MPL_AUX_NA_PARAM(Sequence2_)
  35. >
  36. struct joint_view
  37. {
  38. typedef typename mpl::begin<Sequence1_>::type first1_;
  39. typedef typename mpl::end<Sequence1_>::type last1_;
  40. typedef typename mpl::begin<Sequence2_>::type first2_;
  41. typedef typename mpl::end<Sequence2_>::type last2_;
  42. // agurt, 25/may/03: for the 'size_traits' implementation above
  43. typedef Sequence1_ sequence1_;
  44. typedef Sequence2_ sequence2_;
  45. typedef joint_view type;
  46. typedef aux::joint_view_tag tag;
  47. typedef joint_iter<first1_,last1_,first2_> begin;
  48. typedef joint_iter<last1_,last1_,last2_> end;
  49. };
  50. BOOST_MPL_AUX_NA_SPEC(2, joint_view)
  51. }}
  52. #endif // BOOST_MPL_JOINT_VIEW_HPP_INCLUDED