mpl_interop_test2.cpp 566 B

12345678910111213141516171819202122232425
  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/mpl/if.hpp>
  7. #include <boost/static_assert.hpp>
  8. template <class T>
  9. struct if_test
  10. {
  11. typedef typename boost::mpl::if_<
  12. boost::is_void<T>,
  13. int, T>::type type;
  14. };
  15. if_test<void>::type t1 = 0;
  16. if_test<double>::type t2 = 0;
  17. int main()
  18. {
  19. return (int)(t1 + t2);
  20. }