erase.cpp 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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/erase.hpp>
  12. #include <boost/mpl/list.hpp>
  13. #include <boost/mpl/list_c.hpp>
  14. #include <boost/mpl/find.hpp>
  15. #include <boost/mpl/size.hpp>
  16. #include <boost/mpl/integral_c.hpp>
  17. #include <boost/mpl/begin_end.hpp>
  18. #include <boost/mpl/aux_/test.hpp>
  19. MPL_TEST_CASE()
  20. {
  21. typedef list<int,char,long,short,char,long,double,long> types;
  22. typedef find<types,short>::type iter;
  23. typedef erase<types, iter>::type result;
  24. MPL_ASSERT_RELATION( size<result>::value, ==, 7 );
  25. typedef find<result,short>::type result_iter;
  26. MPL_ASSERT(( is_same< result_iter, end<result>::type > ));
  27. }
  28. MPL_TEST_CASE()
  29. {
  30. typedef list_c<int,1,0,5,1,7,5,0,5> values;
  31. typedef find< values, integral_c<int,7> >::type iter;
  32. typedef erase<values, iter>::type result;
  33. MPL_ASSERT_RELATION( size<result>::value, ==, 7 );
  34. typedef find<result, integral_c<int,7> >::type result_iter;
  35. MPL_ASSERT(( is_same< result_iter, end<result>::type > ));
  36. }