eval_if.cpp 932 B

123456789101112131415161718192021222324252627282930313233
  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/eval_if.hpp>
  12. #include <boost/mpl/bool.hpp>
  13. #include <boost/mpl/identity.hpp>
  14. #include <boost/mpl/aux_/test.hpp>
  15. #include <boost/type_traits/is_same.hpp>
  16. MPL_TEST_CASE()
  17. {
  18. typedef eval_if< true_, identity<char>, identity<long> >::type t1;
  19. typedef eval_if_c< true, identity<char>, identity<long> >::type t2;
  20. typedef eval_if< false_, identity<char>, identity<long> >::type t3;
  21. typedef eval_if_c< false, identity<char>, identity<long> >::type t4;
  22. MPL_ASSERT(( is_same<t1,char> ));
  23. MPL_ASSERT(( is_same<t2,char> ));
  24. MPL_ASSERT(( is_same<t3,long> ));
  25. MPL_ASSERT(( is_same<t4,long> ));
  26. }