always.cpp 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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/apply.hpp>
  12. #include <boost/mpl/always.hpp>
  13. #include <boost/mpl/bool.hpp>
  14. #include <boost/mpl/int.hpp>
  15. #include <boost/mpl/aux_/test.hpp>
  16. MPL_TEST_CASE()
  17. {
  18. typedef always<true_> always_true;
  19. MPL_ASSERT(( apply< always_true > ));
  20. MPL_ASSERT(( apply0< always_true > ));
  21. MPL_ASSERT(( apply1< always_true,false_ > ));
  22. MPL_ASSERT(( apply2< always_true,false_,false_ > ));
  23. MPL_ASSERT(( apply3< always_true,false_,false_,false_ > ));
  24. }
  25. MPL_TEST_CASE()
  26. {
  27. typedef always< int_<10> > always_10;
  28. typedef apply< always_10 >::type res;
  29. typedef apply0< always_10 >::type res0;
  30. typedef apply1< always_10,int_<0> >::type res1;
  31. typedef apply2< always_10,int_<0>,int_<0> >::type res2;
  32. typedef apply3< always_10,int_<0>,int_<0>,int_<0> >::type res3;
  33. MPL_ASSERT_RELATION( res::value, ==, 10 );
  34. MPL_ASSERT_RELATION( res0::value, ==, 10 );
  35. MPL_ASSERT_RELATION( res1::value, ==, 10 );
  36. MPL_ASSERT_RELATION( res2::value, ==, 10 );
  37. MPL_ASSERT_RELATION( res3::value, ==, 10 );
  38. }