Add support for C++23 <stdfloat> types.

This commit is contained in:
jzmaddock committed 2023-10-13 19:45:24 +01:00
1 parent 1ebd31e60e
commit 1573a2c473
7 files changed
+204 -13

No files matched your search

+36
View File
@@ -12,6 +12,10 @@
#include "test.hpp"
#include "check_integral_constant.hpp"
#ifndef BOOST_NO_CXX23_HDR_STDFLOAT
#include <stdfloat>
#endif
TT_TEST_BEGIN(is_arithmetic)
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_arithmetic<bool>::value, true);
@@ -159,6 +163,38 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_arithmetic<boost::uint128_type>::value, t
#ifdef BOOST_HAS_FLOAT128
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_arithmetic<boost::float128_type>::value, true);
#endif
#ifndef BOOST_NO_CXX23_HDR_STDFLOAT
#if defined(__STDCPP_FLOAT16_T__)
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_arithmetic<std::float16_t>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_arithmetic<const std::float16_t>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_arithmetic<volatile std::float16_t>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_arithmetic<const volatile std::float16_t>::value, true);
#endif
#if defined(__STDCPP_FLOAT32_T__)
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_arithmetic<std::float32_t>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_arithmetic<const std::float32_t>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_arithmetic<volatile std::float32_t>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_arithmetic<const volatile std::float32_t>::value, true);
#endif
#if defined(__STDCPP_FLOAT64_T__)
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_arithmetic<std::float32_t>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_arithmetic<const std::float32_t>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_arithmetic<volatile std::float32_t>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_arithmetic<const volatile std::float32_t>::value, true);
#endif
#if defined(__STDCPP_FLOAT128_T__)
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_arithmetic<std::float128_t>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_arithmetic<const std::float128_t>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_arithmetic<volatile std::float128_t>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_arithmetic<const volatile std::float128_t>::value, true);
#endif
#if defined(__STDCPP_BFLOAT16_T__)
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_arithmetic<std::bfloat16_t>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_arithmetic<const std::bfloat16_t>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_arithmetic<volatile std::bfloat16_t>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_arithmetic<const volatile std::bfloat16_t>::value, true);
#endif
#endif
TT_TEST_END
+36
View File
@@ -12,6 +12,10 @@
#include "test.hpp"
#include "check_integral_constant.hpp"
#ifndef BOOST_NO_CXX23_HDR_STDFLOAT
#include <stdfloat>
#endif
TT_TEST_BEGIN(is_floating_point)
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<float>::value, true);
@@ -35,6 +39,38 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<const __float128>::value,
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<volatile __float128>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<const volatile __float128>::value, true);
#endif
#ifndef BOOST_NO_CXX23_HDR_STDFLOAT
#if defined(__STDCPP_FLOAT16_T__)
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<std::float16_t>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<const std::float16_t>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<volatile std::float16_t>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<const volatile std::float16_t>::value, true);
#endif
#if defined(__STDCPP_FLOAT32_T__)
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<std::float32_t>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<const std::float32_t>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<volatile std::float32_t>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<const volatile std::float32_t>::value, true);
#endif
#if defined(__STDCPP_FLOAT64_T__)
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<std::float32_t>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<const std::float32_t>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<volatile std::float32_t>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<const volatile std::float32_t>::value, true);
#endif
#if defined(__STDCPP_FLOAT128_T__)
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<std::float128_t>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<const std::float128_t>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<volatile std::float128_t>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<const volatile std::float128_t>::value, true);
#endif
#if defined(__STDCPP_BFLOAT16_T__)
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<std::bfloat16_t>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<const std::bfloat16_t>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<volatile std::bfloat16_t>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<const volatile std::bfloat16_t>::value, true);
#endif
#endif
//
// cases that should not be true:
+36
View File
@@ -12,6 +12,10 @@
#include "test.hpp"
#include "check_integral_constant.hpp"
#ifndef BOOST_NO_CXX23_HDR_STDFLOAT
#include <stdfloat>
#endif
TT_TEST_BEGIN(is_fundamental)
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_fundamental<void>::value, true);
@@ -164,6 +168,38 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_fundamental<boost::uint128_type>::value,
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_fundamental<boost::float128_type>::value, true);
#endif
#ifndef BOOST_NO_CXX23_HDR_STDFLOAT
#if defined(__STDCPP_FLOAT16_T__)
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_fundamental<std::float16_t>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_fundamental<const std::float16_t>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_fundamental<volatile std::float16_t>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_fundamental<const volatile std::float16_t>::value, true);
#endif
#if defined(__STDCPP_FLOAT32_T__)
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_fundamental<std::float32_t>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_fundamental<const std::float32_t>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_fundamental<volatile std::float32_t>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_fundamental<const volatile std::float32_t>::value, true);
#endif
#if defined(__STDCPP_FLOAT64_T__)
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_fundamental<std::float32_t>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_fundamental<const std::float32_t>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_fundamental<volatile std::float32_t>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_fundamental<const volatile std::float32_t>::value, true);
#endif
#if defined(__STDCPP_FLOAT128_T__)
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_fundamental<std::float128_t>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_fundamental<const std::float128_t>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_fundamental<volatile std::float128_t>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_fundamental<const volatile std::float128_t>::value, true);
#endif
#if defined(__STDCPP_BFLOAT16_T__)
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_fundamental<std::bfloat16_t>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_fundamental<const std::bfloat16_t>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_fundamental<volatile std::bfloat16_t>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_fundamental<const volatile std::bfloat16_t>::value, true);
#endif
#endif
TT_TEST_END
+37 -7
View File
@@ -12,6 +12,10 @@
#include "test.hpp"
#include "check_integral_constant.hpp"
#ifndef BOOST_NO_CXX23_HDR_STDFLOAT
#include <stdfloat>
#endif
TT_TEST_BEGIN(is_pod)
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<bool>::value, true);
@@ -186,12 +190,38 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<boost::uint128_type>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<boost::float128_type>::value, true);
#endif
#ifndef BOOST_NO_CXX23_HDR_STDFLOAT
#if defined(__STDCPP_FLOAT16_T__)
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<std::float16_t>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<const std::float16_t>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<volatile std::float16_t>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<const volatile std::float16_t>::value, true);
#endif
#if defined(__STDCPP_FLOAT32_T__)
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<std::float32_t>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<const std::float32_t>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<volatile std::float32_t>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<const volatile std::float32_t>::value, true);
#endif
#if defined(__STDCPP_FLOAT64_T__)
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<std::float32_t>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<const std::float32_t>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<volatile std::float32_t>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<const volatile std::float32_t>::value, true);
#endif
#if defined(__STDCPP_FLOAT128_T__)
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<std::float128_t>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<const std::float128_t>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<volatile std::float128_t>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<const volatile std::float128_t>::value, true);
#endif
#if defined(__STDCPP_BFLOAT16_T__)
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<std::bfloat16_t>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<const std::bfloat16_t>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<volatile std::bfloat16_t>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<const volatile std::bfloat16_t>::value, true);
#endif
#endif
TT_TEST_END
+36 -6
View File
@@ -12,6 +12,10 @@
#include "test.hpp"
#include "check_integral_constant.hpp"
#ifndef BOOST_NO_CXX23_HDR_STDFLOAT
#include <stdfloat>
#endif
TT_TEST_BEGIN(is_scalar)
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_scalar<bool>::value, true);
@@ -165,13 +169,39 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_scalar<boost::uint128_type>::value, true)
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_scalar<boost::float128_type>::value, true);
#endif
#ifndef BOOST_NO_CXX23_HDR_STDFLOAT
#if defined(__STDCPP_FLOAT16_T__)
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_scalar<std::float16_t>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_scalar<const std::float16_t>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_scalar<volatile std::float16_t>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_scalar<const volatile std::float16_t>::value, true);
#endif
#if defined(__STDCPP_FLOAT32_T__)
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_scalar<std::float32_t>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_scalar<const std::float32_t>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_scalar<volatile std::float32_t>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_scalar<const volatile std::float32_t>::value, true);
#endif
#if defined(__STDCPP_FLOAT64_T__)
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_scalar<std::float32_t>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_scalar<const std::float32_t>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_scalar<volatile std::float32_t>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_scalar<const volatile std::float32_t>::value, true);
#endif
#if defined(__STDCPP_FLOAT128_T__)
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_scalar<std::float128_t>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_scalar<const std::float128_t>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_scalar<volatile std::float128_t>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_scalar<const volatile std::float128_t>::value, true);
#endif
#if defined(__STDCPP_BFLOAT16_T__)
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_scalar<std::bfloat16_t>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_scalar<const std::bfloat16_t>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_scalar<volatile std::bfloat16_t>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_scalar<const volatile std::bfloat16_t>::value, true);
#endif
#endif
TT_TEST_END