quote.cpp 934 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // Copyright Aleksey Gurtovoy 2000-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/quote.hpp>
  12. #include <boost/type_traits/is_same.hpp>
  13. #include <boost/mpl/aux_/test.hpp>
  14. template< typename T > struct f1
  15. {
  16. typedef T type;
  17. };
  18. template<
  19. typename T1, typename T2, typename T3, typename T4, typename T5
  20. >
  21. struct f5
  22. {
  23. #if !defined(BOOST_MPL_CFG_NO_IMPLICIT_METAFUNCTIONS)
  24. // no 'type' member!
  25. #else
  26. typedef f5 type;
  27. #endif
  28. };
  29. MPL_TEST_CASE()
  30. {
  31. typedef quote1<f1>::apply<int>::type t1;
  32. typedef quote5<f5>::apply<char,short,int,long,float>::type t5;
  33. MPL_ASSERT(( boost::is_same< t1, int > ));
  34. MPL_ASSERT(( boost::is_same< t5, f5<char,short,int,long,float> > ));
  35. }