From 1573a2c4739f04d88a3f5f39e9fbcb8d5eebfd3b Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Fri, 13 Oct 2023 19:45:24 +0100 Subject: [PATCH] Add support for C++23 types. --- .drone.star | 1 + .../boost/type_traits/is_floating_point.hpp | 22 ++++++++++ test/is_arithmetic_test.cpp | 36 +++++++++++++++ test/is_floating_point_test.cpp | 36 +++++++++++++++ test/is_fundamental_test.cpp | 36 +++++++++++++++ test/is_pod_test.cpp | 44 ++++++++++++++++--- test/is_scalar_test.cpp | 42 +++++++++++++++--- 7 files changed, 204 insertions(+), 13 deletions(-) diff --git a/.drone.star b/.drone.star index bdb1d43d21..6a650532d4 100644 --- a/.drone.star +++ b/.drone.star @@ -41,6 +41,7 @@ def main(ctx): linux_cxx("TOOLSET=clang COMPILER=clang++-8 CXXSTD=03,11,14,17 2a Job 26", "clang++-8", packages="clang-8", llvm_os="xenial", llvm_ver="8", buildtype="boost", image=linuxglobalimage, environment={'TOOLSET': 'clang', 'COMPILER': 'clang++-8', 'CXXSTD': '03,11,14,17,2a'}, globalenv=globalenv), linux_cxx("TOOLSET=clang COMPILER=clang++-9 CXXSTD=03,11,14,17,2a Job 27", "clang++-9", packages="clang-9", llvm_os="xenial", llvm_ver="9", buildtype="boost", image=linuxglobalimage, environment={'TOOLSET': 'clang', 'COMPILER': 'clang++-9', 'CXXSTD': '03,11,14,17,2a'}, globalenv=globalenv), linux_cxx("TOOLSET=clang COMPILER=clang++-10 CXXSTD=03,11,14,17,20 Job 28", "clang++-10", packages="clang-10", llvm_os="xenial", llvm_ver="10", buildtype="boost", image=linuxglobalimage, environment={'TOOLSET': 'clang', 'COMPILER': 'clang++-10', 'CXXSTD': '03,11,14,17,20'}, globalenv=globalenv), + linux_cxx("Ubuntu g++-13", packages="g++-13", buildtype="boost", image="cppalliance/droneubuntu2304:1", environment={'TOOLSET': 'gcc', 'COMPILER': 'g++-13', 'CXXSTD': '14,17,20,23', }, globalenv=globalenv), osx_cxx("XCode-11.7 CXXSTD=03,11,14,17,2a Job 29", "clang++", packages="", buildtype="boost", xcode_version="11.7", environment={'TOOLSET': 'clang', 'COMPILER': 'clang++', 'CXXSTD': '03,11,14,17,2a', 'DRONE_JOB_OS_NAME': 'osx'}, globalenv=globalenv), osx_cxx("XCode-10.2 CXXSTD=03,11,14,17,2a Job 30", "clang++", packages="", buildtype="boost", xcode_version="10.2", environment={'TOOLSET': 'clang', 'COMPILER': 'clang++', 'CXXSTD': '03,11,14,17,2a', 'DRONE_JOB_OS_NAME': 'osx'}, globalenv=globalenv), osx_cxx("XCode-9.4 CXXSTD=03,11,14,1z Job 31", "clang++", packages="", buildtype="boost", xcode_version="9.4", environment={'TOOLSET': 'clang', 'COMPILER': 'clang++', 'CXXSTD': '03,11,14,1z', 'DRONE_JOB_OS_NAME': 'osx'}, globalenv=globalenv), diff --git a/include/boost/type_traits/is_floating_point.hpp b/include/boost/type_traits/is_floating_point.hpp index 196c900cf9..f9f3d39567 100644 --- a/include/boost/type_traits/is_floating_point.hpp +++ b/include/boost/type_traits/is_floating_point.hpp @@ -10,6 +10,10 @@ #include +#ifndef BOOST_NO_CXX23_HDR_STDFLOAT +#include +#endif + namespace boost { //* is a type T a floating-point type described in the standard (3.9.1p8) @@ -25,6 +29,24 @@ namespace boost { template<> struct is_floating_point<__float128> : public true_type{}; #endif +#ifndef BOOST_NO_CXX23_HDR_STDFLOAT +#if defined(__STDCPP_FLOAT16_T__) + template<> struct is_floating_point : public true_type {}; +#endif +#if defined(__STDCPP_FLOAT32_T__) + template<> struct is_floating_point : public true_type {}; +#endif +#if defined(__STDCPP_FLOAT64_T__) + template<> struct is_floating_point : public true_type {}; +#endif +#if defined(__STDCPP_FLOAT128_T__) + template<> struct is_floating_point : public true_type {}; +#endif +#if defined(__STDCPP_BFLOAT16_T__) + template<> struct is_floating_point : public true_type {}; +#endif +#endif + } // namespace boost #endif // BOOST_TYPE_TRAITS_IS_FLOAT_HPP_INCLUDED diff --git a/test/is_arithmetic_test.cpp b/test/is_arithmetic_test.cpp index 13007cbfeb..e911d381b3 100644 --- a/test/is_arithmetic_test.cpp +++ b/test/is_arithmetic_test.cpp @@ -12,6 +12,10 @@ #include "test.hpp" #include "check_integral_constant.hpp" +#ifndef BOOST_NO_CXX23_HDR_STDFLOAT +#include +#endif + TT_TEST_BEGIN(is_arithmetic) BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_arithmetic::value, true); @@ -159,6 +163,38 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_arithmetic::value, t #ifdef BOOST_HAS_FLOAT128 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_arithmetic::value, true); #endif +#ifndef BOOST_NO_CXX23_HDR_STDFLOAT +#if defined(__STDCPP_FLOAT16_T__) +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_arithmetic::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_arithmetic::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_arithmetic::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_arithmetic::value, true); +#endif +#if defined(__STDCPP_FLOAT32_T__) +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_arithmetic::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_arithmetic::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_arithmetic::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_arithmetic::value, true); +#endif +#if defined(__STDCPP_FLOAT64_T__) +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_arithmetic::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_arithmetic::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_arithmetic::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_arithmetic::value, true); +#endif +#if defined(__STDCPP_FLOAT128_T__) +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_arithmetic::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_arithmetic::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_arithmetic::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_arithmetic::value, true); +#endif +#if defined(__STDCPP_BFLOAT16_T__) +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_arithmetic::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_arithmetic::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_arithmetic::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_arithmetic::value, true); +#endif +#endif TT_TEST_END diff --git a/test/is_floating_point_test.cpp b/test/is_floating_point_test.cpp index c9b15b03e3..fca569fad1 100644 --- a/test/is_floating_point_test.cpp +++ b/test/is_floating_point_test.cpp @@ -12,6 +12,10 @@ #include "test.hpp" #include "check_integral_constant.hpp" +#ifndef BOOST_NO_CXX23_HDR_STDFLOAT +#include +#endif + TT_TEST_BEGIN(is_floating_point) BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point::value, true); @@ -35,6 +39,38 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point::value, BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point::value, true); #endif +#ifndef BOOST_NO_CXX23_HDR_STDFLOAT +#if defined(__STDCPP_FLOAT16_T__) +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point::value, true); +#endif +#if defined(__STDCPP_FLOAT32_T__) +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point::value, true); +#endif +#if defined(__STDCPP_FLOAT64_T__) +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point::value, true); +#endif +#if defined(__STDCPP_FLOAT128_T__) +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point::value, true); +#endif +#if defined(__STDCPP_BFLOAT16_T__) +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point::value, true); +#endif +#endif // // cases that should not be true: diff --git a/test/is_fundamental_test.cpp b/test/is_fundamental_test.cpp index ab97f9893f..6d2cd39c3b 100644 --- a/test/is_fundamental_test.cpp +++ b/test/is_fundamental_test.cpp @@ -12,6 +12,10 @@ #include "test.hpp" #include "check_integral_constant.hpp" +#ifndef BOOST_NO_CXX23_HDR_STDFLOAT +#include +#endif + TT_TEST_BEGIN(is_fundamental) BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_fundamental::value, true); @@ -164,6 +168,38 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_fundamental::value, BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_fundamental::value, true); #endif +#ifndef BOOST_NO_CXX23_HDR_STDFLOAT +#if defined(__STDCPP_FLOAT16_T__) +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_fundamental::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_fundamental::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_fundamental::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_fundamental::value, true); +#endif +#if defined(__STDCPP_FLOAT32_T__) +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_fundamental::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_fundamental::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_fundamental::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_fundamental::value, true); +#endif +#if defined(__STDCPP_FLOAT64_T__) +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_fundamental::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_fundamental::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_fundamental::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_fundamental::value, true); +#endif +#if defined(__STDCPP_FLOAT128_T__) +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_fundamental::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_fundamental::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_fundamental::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_fundamental::value, true); +#endif +#if defined(__STDCPP_BFLOAT16_T__) +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_fundamental::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_fundamental::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_fundamental::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_fundamental::value, true); +#endif +#endif TT_TEST_END diff --git a/test/is_pod_test.cpp b/test/is_pod_test.cpp index 861037c317..eab158da28 100644 --- a/test/is_pod_test.cpp +++ b/test/is_pod_test.cpp @@ -12,6 +12,10 @@ #include "test.hpp" #include "check_integral_constant.hpp" +#ifndef BOOST_NO_CXX23_HDR_STDFLOAT +#include +#endif + TT_TEST_BEGIN(is_pod) BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod::value, true); @@ -186,12 +190,38 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod::value, true); #endif -TT_TEST_END - - - - - - +#ifndef BOOST_NO_CXX23_HDR_STDFLOAT +#if defined(__STDCPP_FLOAT16_T__) +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod::value, true); +#endif +#if defined(__STDCPP_FLOAT32_T__) +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod::value, true); +#endif +#if defined(__STDCPP_FLOAT64_T__) +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod::value, true); +#endif +#if defined(__STDCPP_FLOAT128_T__) +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod::value, true); +#endif +#if defined(__STDCPP_BFLOAT16_T__) +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod::value, true); +#endif +#endif +TT_TEST_END diff --git a/test/is_scalar_test.cpp b/test/is_scalar_test.cpp index 2017d0f00b..77b29afeef 100644 --- a/test/is_scalar_test.cpp +++ b/test/is_scalar_test.cpp @@ -12,6 +12,10 @@ #include "test.hpp" #include "check_integral_constant.hpp" +#ifndef BOOST_NO_CXX23_HDR_STDFLOAT +#include +#endif + TT_TEST_BEGIN(is_scalar) BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_scalar::value, true); @@ -165,13 +169,39 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_scalar::value, true) BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_scalar::value, true); #endif +#ifndef BOOST_NO_CXX23_HDR_STDFLOAT +#if defined(__STDCPP_FLOAT16_T__) +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_scalar::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_scalar::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_scalar::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_scalar::value, true); +#endif +#if defined(__STDCPP_FLOAT32_T__) +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_scalar::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_scalar::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_scalar::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_scalar::value, true); +#endif +#if defined(__STDCPP_FLOAT64_T__) +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_scalar::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_scalar::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_scalar::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_scalar::value, true); +#endif +#if defined(__STDCPP_FLOAT128_T__) +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_scalar::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_scalar::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_scalar::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_scalar::value, true); +#endif +#if defined(__STDCPP_BFLOAT16_T__) +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_scalar::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_scalar::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_scalar::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_scalar::value, true); +#endif +#endif TT_TEST_END - - - - - -