treat_as_floating_point_pass.cpp 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. //===----------------------------------------------------------------------===//
  2. //
  3. // The LLVM Compiler Infrastructure
  4. //
  5. // This file is dual licensed under the MIT and the University of Illinois Open
  6. // Source Licenses. See LICENSE.TXT for details.
  7. //
  8. //===----------------------------------------------------------------------===//
  9. // Adaptation to Boost of the libcxx
  10. // Copyright 2010 Vicente J. Botet Escriba
  11. // Distributed under the Boost Software License, Version 1.0.
  12. // See http://www.boost.org/LICENSE_1_0.txt
  13. #include <boost/chrono/chrono.hpp>
  14. #include <boost/type_traits.hpp>
  15. #if !defined(BOOST_NO_CXX11_STATIC_ASSERT)
  16. #define NOTHING ""
  17. #endif
  18. template <class T>
  19. void
  20. test()
  21. {
  22. BOOST_CHRONO_STATIC_ASSERT((boost::is_base_of<boost::is_floating_point<T>,
  23. boost::chrono::treat_as_floating_point<T> >::value), NOTHING, ());
  24. }
  25. struct A {};
  26. void testall()
  27. {
  28. test<int>();
  29. test<unsigned>();
  30. test<char>();
  31. test<bool>();
  32. test<float>();
  33. test<double>();
  34. test<long double>();
  35. test<A>();
  36. }