distance.cpp 859 B

12345678910111213141516171819202122232425262728293031323334353637
  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/distance.hpp>
  12. #include <boost/mpl/list.hpp>
  13. #include <boost/mpl/range_c.hpp>
  14. #include <boost/mpl/aux_/test.hpp>
  15. MPL_TEST_CASE()
  16. {
  17. typedef list<char,short,int,long>::type list;
  18. typedef begin<list>::type first;
  19. typedef end<list>::type last;
  20. MPL_ASSERT_RELATION( (mpl::distance<first,last>::value), ==, 4 );
  21. }
  22. MPL_TEST_CASE()
  23. {
  24. typedef range_c<int,0,10>::type range;
  25. typedef begin<range>::type first;
  26. typedef end<range>::type last;
  27. MPL_ASSERT_RELATION( (mpl::distance<first,last>::value), ==, 10 );
  28. }