mpl_interop_test3.cpp 947 B

123456789101112131415161718192021222324252627282930
  1. // (C) Copyright John Maddock 2000.
  2. // Use, modification and distribution are subject to the
  3. // Boost Software License, Version 1.0. (See accompanying file
  4. // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  5. #include <boost/type_traits/is_void.hpp>
  6. #include <boost/type_traits/add_const.hpp>
  7. #include <boost/mpl/list.hpp>
  8. #include <boost/mpl/front.hpp>
  9. #include <boost/mpl/remove_if.hpp>
  10. #include <boost/mpl/transform.hpp>
  11. #include <boost/static_assert.hpp>
  12. template <class List>
  13. struct lambda_test
  14. {
  15. typedef typename boost::mpl::remove_if<List, boost::is_void<boost::mpl::_> >::type reduced_list;
  16. typedef typename boost::mpl::transform<reduced_list, boost::add_const<boost::mpl::_> >::type const_list;
  17. typedef typename boost::mpl::front<const_list>::type type;
  18. };
  19. int main()
  20. {
  21. typedef boost::mpl::list<const void, int, float, void, double> list_type;
  22. lambda_test<list_type>::type i = 0;
  23. return i;
  24. }