transform_view.cpp 992 B

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