pair_view.cpp 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // Copyright David Abrahams 2003-2004
  2. // Copyright Aleksey Gurtovoy 2004
  3. //
  4. // Distributed under the Boost Software License, Version 1.0.
  5. // (See accompanying file LICENSE_1_0.txt or copy at
  6. // http://www.boost.org/LICENSE_1_0.txt)
  7. //
  8. // See http://www.boost.org/libs/mpl for documentation.
  9. // $Id$
  10. // $Date$
  11. // $Revision$
  12. #include <boost/mpl/pair_view.hpp>
  13. #include <boost/mpl/vector/vector50_c.hpp>
  14. #include <boost/mpl/range_c.hpp>
  15. #include <boost/mpl/distance.hpp>
  16. #include <boost/mpl/aux_/test.hpp>
  17. MPL_TEST_CASE()
  18. {
  19. typedef range_c<int,0,10> r;
  20. typedef vector10_c<int,9,8,7,6,5,4,3,2,1,10> v;
  21. typedef pair_view<r,v> view;
  22. typedef begin<view>::type first_;
  23. typedef end<view>::type last_;
  24. MPL_ASSERT(( is_same< first_::category, mpl::random_access_iterator_tag > ));
  25. MPL_ASSERT(( is_same< advance_c<first_,0>::type, first_ > ));
  26. MPL_ASSERT(( is_same< advance_c<last_,0>::type, last_ > ));
  27. MPL_ASSERT(( is_same< advance_c<first_,10>::type, last_ > ));
  28. MPL_ASSERT(( is_same< advance_c<last_,-10>::type, first_ > ));
  29. typedef advance_c<first_,5>::type iter;
  30. MPL_ASSERT(( is_same<
  31. deref<iter>::type
  32. , mpl::pair< integral_c<int,5>,integral_c<int,4> >
  33. > ));
  34. }