lower_bound.cpp 768 B

12345678910111213141516171819202122232425262728
  1. // Copyright Aleksey Gurtovoy 2001-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/lower_bound.hpp>
  12. #include <boost/mpl/distance.hpp>
  13. #include <boost/mpl/list_c.hpp>
  14. #include <boost/mpl/less.hpp>
  15. #include <boost/mpl/int.hpp>
  16. #include <boost/mpl/aux_/test.hpp>
  17. MPL_TEST_CASE()
  18. {
  19. typedef list_c<int,1,2,3,3,3,5,8> numbers;
  20. typedef lower_bound< numbers, int_<4> >::type iter;
  21. MPL_ASSERT_RELATION( (mpl::distance< begin<numbers>::type,iter >::value), ==, 5 );
  22. MPL_ASSERT_RELATION( deref<iter>::type::value, ==, 5 );
  23. }