at.cpp 972 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. // Copyright Aleksey Gurtovoy 2000-2004
  2. //
  3. // Distributed under the Boost Software License, Version 1.0.
  4. // (See accompanying file LICENSE_1_0.txt or copy at
  5. // http://www.boost.org/LICENSE_1_0.txt)
  6. //
  7. // See http://www.boost.org/libs/mpl for documentation.
  8. // $Id$
  9. // $Date$
  10. // $Revision$
  11. #include <boost/mpl/at.hpp>
  12. #include <boost/mpl/vector/vector10_c.hpp>
  13. #include <boost/mpl/aux_/test.hpp>
  14. template< typename Seq, int n > struct at_test
  15. {
  16. typedef typename at_c<Seq,n>::type t;
  17. MPL_ASSERT(( is_same< t, integral_c<int,9-n> > ));
  18. MPL_ASSERT_RELATION( t::value, ==, 9 - n );
  19. };
  20. MPL_TEST_CASE()
  21. {
  22. typedef vector10_c<int,9,8,7,6,5,4,3,2,1,0> numbers;
  23. at_test< numbers, 0 >();
  24. at_test< numbers, 1 >();
  25. at_test< numbers, 2 >();
  26. at_test< numbers, 3 >();
  27. at_test< numbers, 4 >();
  28. at_test< numbers, 5 >();
  29. at_test< numbers, 6 >();
  30. at_test< numbers, 7 >();
  31. at_test< numbers, 8 >();
  32. at_test< numbers, 9 >();
  33. }