is_iec559.hpp 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. * Distributed under the Boost Software License, Version 1.0.
  3. * (See accompanying file LICENSE_1_0.txt or copy at
  4. * http://www.boost.org/LICENSE_1_0.txt)
  5. *
  6. * Copyright (c) 2018 Andrey Semashev
  7. */
  8. /*!
  9. * \file atomic/detail/type_traits/is_iec559.hpp
  10. *
  11. * This header defines \c is_iec559 type trait
  12. */
  13. #ifndef BOOST_ATOMIC_DETAIL_TYPE_TRAITS_IS_IEC559_HPP_INCLUDED_
  14. #define BOOST_ATOMIC_DETAIL_TYPE_TRAITS_IS_IEC559_HPP_INCLUDED_
  15. #include <limits>
  16. #include <boost/atomic/detail/config.hpp>
  17. #ifdef BOOST_HAS_PRAGMA_ONCE
  18. #pragma once
  19. #endif
  20. namespace boost {
  21. namespace atomics {
  22. namespace detail {
  23. template< typename T >
  24. struct is_iec559
  25. {
  26. static BOOST_CONSTEXPR_OR_CONST bool value = !!std::numeric_limits< T >::is_iec559;
  27. };
  28. #if defined(BOOST_HAS_FLOAT128)
  29. // libstdc++ does not specialize numeric_limits for __float128
  30. template< >
  31. struct is_iec559< boost::float128_type >
  32. {
  33. static BOOST_CONSTEXPR_OR_CONST bool value = true;
  34. };
  35. #endif // defined(BOOST_HAS_FLOAT128)
  36. } // namespace detail
  37. } // namespace atomics
  38. } // namespace boost
  39. #endif // BOOST_ATOMIC_DETAIL_TYPE_TRAITS_IS_IEC559_HPP_INCLUDED_