stable_partition.cpp 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // Copyright Aleksey Gurtovoy 2004
  2. // Copyright Eric Friedman 2003
  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/stable_partition.hpp>
  13. #include <boost/mpl/vector_c.hpp>
  14. #include <boost/mpl/equal.hpp>
  15. #include <boost/mpl/comparison.hpp>
  16. #include <boost/mpl/int.hpp>
  17. #include <boost/mpl/aux_/test.hpp>
  18. typedef vector_c<int,3,4,0,-5,8,-1,7>::type numbers;
  19. typedef vector_c<int,0,-5,-1>::type manual_first;
  20. typedef vector_c<int,3,4,8,7>::type manual_second;
  21. MPL_TEST_CASE()
  22. {
  23. typedef stable_partition<
  24. numbers
  25. , less< _, int_<3> >
  26. >::type result;
  27. MPL_ASSERT(( equal< result::first,manual_first > ));
  28. MPL_ASSERT(( equal< result::second,manual_second > ));
  29. }
  30. MPL_TEST_CASE()
  31. {
  32. typedef stable_partition<
  33. numbers
  34. , greater_equal< _, int_<3> >
  35. >::type result;
  36. MPL_ASSERT(( equal< result::first,manual_second > ));
  37. MPL_ASSERT(( equal< result::second,manual_first > ));
  38. }