replace_if.cpp 883 B

123456789101112131415161718192021222324252627282930313233
  1. // Copyright Aleksey Gurtovoy 2000-2004
  2. // Copyright John R. Bandela 2000-2002
  3. // Copyright David Abrahams 2003-2004
  4. //
  5. // Distributed under the Boost Software License, Version 1.0.
  6. // (See accompanying file LICENSE_1_0.txt or copy at
  7. // http://www.boost.org/LICENSE_1_0.txt)
  8. //
  9. // See http://www.boost.org/libs/mpl for documentation.
  10. // $Id$
  11. // $Date$
  12. // $Revision$
  13. #include <boost/mpl/replace_if.hpp>
  14. #include <boost/mpl/list/list10_c.hpp>
  15. #include <boost/mpl/int.hpp>
  16. #include <boost/mpl/equal.hpp>
  17. #include <boost/mpl/greater.hpp>
  18. #include <boost/mpl/equal_to.hpp>
  19. #include <boost/mpl/aux_/test.hpp>
  20. MPL_TEST_CASE()
  21. {
  22. typedef list8_c<int,1,4,5,2,7,5,3,5>::type numbers;
  23. typedef replace_if< numbers, greater<_1,int_<4> >, int_<0> >::type result;
  24. typedef list8_c<int,1,4,0,2,0,0,3,0>::type answer;
  25. MPL_ASSERT(( equal< answer,result,equal_to<_1,_2> > ));
  26. }