class_type_transform.cpp 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. // (C) Copyright Tobias Schwinger
  2. //
  3. // Use modification and distribution are subject to the boost Software License,
  4. // Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt).
  5. //------------------------------------------------------------------------------
  6. #include <boost/type_traits/is_same.hpp>
  7. #include <boost/type_traits/add_pointer.hpp>
  8. #include <boost/mpl/assert.hpp>
  9. #include <boost/mpl/at.hpp>
  10. #include <boost/mpl/placeholders.hpp>
  11. #include <boost/mpl/always.hpp>
  12. #include <boost/function_types/components.hpp>
  13. #include <boost/function_types/parameter_types.hpp>
  14. using namespace boost;
  15. namespace ft = function_types;
  16. using boost::mpl::placeholders::_;
  17. class C;
  18. typedef C (C::*mem_func_ptr)();
  19. class X;
  20. BOOST_MPL_ASSERT((
  21. is_same< mpl::at_c<
  22. ft::components<mem_func_ptr, add_pointer<_> >
  23. ,1 >::type, C* >
  24. ));
  25. BOOST_MPL_ASSERT((
  26. is_same< mpl::at_c<
  27. ft::components<mem_func_ptr, add_pointer< add_pointer<_> > >
  28. ,1 >::type, C** >
  29. ));
  30. BOOST_MPL_ASSERT((
  31. is_same< mpl::at_c<
  32. ft::components<mem_func_ptr, mpl::always<X> >
  33. ,1 >::type, X >
  34. ));
  35. BOOST_MPL_ASSERT((
  36. is_same< mpl::at_c<
  37. ft::parameter_types<mem_func_ptr, add_pointer<_> >
  38. ,0 >::type, C* >
  39. ));
  40. BOOST_MPL_ASSERT((
  41. is_same< mpl::at_c<
  42. ft::parameter_types<mem_func_ptr, add_pointer< add_pointer<_> > >
  43. ,0 >::type, C** >
  44. ));
  45. BOOST_MPL_ASSERT((
  46. is_same< mpl::at_c<
  47. ft::parameter_types<mem_func_ptr, mpl::always<X> >
  48. ,0 >::type, X >
  49. ));