filter_view.cpp 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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/static_assert.hpp>
  12. #include <boost/mpl/filter_view.hpp>
  13. #include <boost/mpl/transform_view.hpp>
  14. #include <boost/mpl/max_element.hpp>
  15. #include <boost/mpl/list.hpp>
  16. #include <boost/mpl/sizeof.hpp>
  17. #include <boost/mpl/deref.hpp>
  18. #include <boost/mpl/equal.hpp>
  19. #include <boost/mpl/aux_/test.hpp>
  20. #include <boost/type_traits/is_float.hpp>
  21. #include <boost/type_traits/is_same.hpp>
  22. MPL_TEST_CASE()
  23. {
  24. typedef mpl::list<int,float,long,float,char[50],long double,char> types;
  25. typedef mpl::list<float,float,long double> floats;
  26. MPL_ASSERT(( equal< mpl::filter_view< types,boost::is_float<_> >::type,floats > ));
  27. typedef mpl::max_element<
  28. mpl::transform_view<
  29. mpl::filter_view< types,boost::is_float<_> >
  30. , mpl::sizeof_<_>
  31. >
  32. >::type iter;
  33. MPL_ASSERT((is_same<mpl::deref<iter::base>::type, long double>));
  34. }