From 86c24916b2c43049ae276154078a7463dfd5bee0 Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Tue, 25 Oct 2022 18:51:29 +0100 Subject: [PATCH] Assert when features which require C++17 are compiled for an earlier C++ version. Also document C++17 requirement for norms. --- doc/vector_functionals/norms.qbk | 2 ++ include/boost/math/ccmath/abs.hpp | 8 ++++++++ include/boost/math/ccmath/div.hpp | 8 ++++++++ include/boost/math/ccmath/fma.hpp | 8 ++++++++ include/boost/math/ccmath/isfinite.hpp | 8 ++++++++ include/boost/math/ccmath/isinf.hpp | 8 ++++++++ include/boost/math/ccmath/isnan.hpp | 8 ++++++++ include/boost/math/ccmath/isnormal.hpp | 8 ++++++++ include/boost/math/ccmath/round.hpp | 8 ++++++++ include/boost/math/ccmath/signbit.hpp | 8 ++++++++ include/boost/math/differentiation/lanczos_smoothing.hpp | 8 ++++++++ .../empirical_cumulative_distribution_function.hpp | 8 ++++++++ include/boost/math/filters/daubechies.hpp | 8 ++++++++ .../boost/math/special_functions/daubechies_scaling.hpp | 8 ++++++++ .../boost/math/special_functions/daubechies_wavelet.hpp | 8 ++++++++ include/boost/math/special_functions/rsqrt.hpp | 8 ++++++++ include/boost/math/statistics/signal_statistics.hpp | 7 +++++++ include/boost/math/tools/centered_continued_fraction.hpp | 7 +++++++ include/boost/math/tools/condition_numbers.hpp | 8 ++++++++ include/boost/math/tools/engel_expansion.hpp | 8 ++++++++ include/boost/math/tools/luroth_expansion.hpp | 8 ++++++++ include/boost/math/tools/norms.hpp | 8 ++++++++ include/boost/math/tools/signal_statistics.hpp | 8 ++++++++ include/boost/math/tools/simple_continued_fraction.hpp | 7 +++++++ include/boost/math/tools/univariate_statistics.hpp | 8 ++++++++ 25 files changed, 191 insertions(+) diff --git a/doc/vector_functionals/norms.qbk b/doc/vector_functionals/norms.qbk index b809540b16..e688c04b96 100644 --- a/doc/vector_functionals/norms.qbk +++ b/doc/vector_functionals/norms.qbk @@ -8,6 +8,8 @@ [section:norms Norms] +[note All of the functions below require at least C++17] + [heading Synopsis] `` diff --git a/include/boost/math/ccmath/abs.hpp b/include/boost/math/ccmath/abs.hpp index 8e9317c517..1c9a6badd4 100644 --- a/include/boost/math/ccmath/abs.hpp +++ b/include/boost/math/ccmath/abs.hpp @@ -15,6 +15,14 @@ #include #include +#include +#ifndef BOOST_MATH_STANDALONE +#include +#ifdef BOOST_NO_CXX17_IF_CONSTEXPR +#error "The header can only be used in C++17 and later." +#endif +#endif + namespace boost::math::ccmath { namespace detail { diff --git a/include/boost/math/ccmath/div.hpp b/include/boost/math/ccmath/div.hpp index 9553c7d397..3fb517be40 100644 --- a/include/boost/math/ccmath/div.hpp +++ b/include/boost/math/ccmath/div.hpp @@ -12,6 +12,14 @@ #include #include +#include +#ifndef BOOST_MATH_STANDALONE +#include +#ifdef BOOST_NO_CXX17_IF_CONSTEXPR +#error "The header can only be used in C++17 and later." +#endif +#endif + namespace boost::math::ccmath { namespace detail { diff --git a/include/boost/math/ccmath/fma.hpp b/include/boost/math/ccmath/fma.hpp index 3056f76d47..7bc12fe7a6 100644 --- a/include/boost/math/ccmath/fma.hpp +++ b/include/boost/math/ccmath/fma.hpp @@ -13,6 +13,14 @@ #include #include +#include +#ifndef BOOST_MATH_STANDALONE +#include +#ifdef BOOST_NO_CXX17_IF_CONSTEXPR +#error "The header can only be used in C++17 and later." +#endif +#endif + namespace boost::math::ccmath { namespace detail { diff --git a/include/boost/math/ccmath/isfinite.hpp b/include/boost/math/ccmath/isfinite.hpp index 717a14f44e..6b407bfa57 100644 --- a/include/boost/math/ccmath/isfinite.hpp +++ b/include/boost/math/ccmath/isfinite.hpp @@ -12,6 +12,14 @@ #include #include +#include +#ifndef BOOST_MATH_STANDALONE +#include +#ifdef BOOST_NO_CXX17_IF_CONSTEXPR +#error "The header can only be used in C++17 and later." +#endif +#endif + namespace boost::math::ccmath { template diff --git a/include/boost/math/ccmath/isinf.hpp b/include/boost/math/ccmath/isinf.hpp index 15787c25bc..d3e4358c4e 100644 --- a/include/boost/math/ccmath/isinf.hpp +++ b/include/boost/math/ccmath/isinf.hpp @@ -11,6 +11,14 @@ #include #include +#include +#ifndef BOOST_MATH_STANDALONE +#include +#ifdef BOOST_NO_CXX17_IF_CONSTEXPR +#error "The header can only be used in C++17 and later." +#endif +#endif + namespace boost::math::ccmath { template diff --git a/include/boost/math/ccmath/isnan.hpp b/include/boost/math/ccmath/isnan.hpp index e56a2f3cb0..ca915a4642 100644 --- a/include/boost/math/ccmath/isnan.hpp +++ b/include/boost/math/ccmath/isnan.hpp @@ -10,6 +10,14 @@ #include #include +#include +#ifndef BOOST_MATH_STANDALONE +#include +#ifdef BOOST_NO_CXX17_IF_CONSTEXPR +#error "The header can only be used in C++17 and later." +#endif +#endif + namespace boost::math::ccmath { template diff --git a/include/boost/math/ccmath/isnormal.hpp b/include/boost/math/ccmath/isnormal.hpp index f352a0466a..8310a65848 100644 --- a/include/boost/math/ccmath/isnormal.hpp +++ b/include/boost/math/ccmath/isnormal.hpp @@ -14,6 +14,14 @@ #include #include +#include +#ifndef BOOST_MATH_STANDALONE +#include +#ifdef BOOST_NO_CXX17_IF_CONSTEXPR +#error "The header can only be used in C++17 and later." +#endif +#endif + namespace boost::math::ccmath { template diff --git a/include/boost/math/ccmath/round.hpp b/include/boost/math/ccmath/round.hpp index 5c8c80eb9f..6b7947e646 100644 --- a/include/boost/math/ccmath/round.hpp +++ b/include/boost/math/ccmath/round.hpp @@ -15,6 +15,14 @@ #include #include +#include +#ifndef BOOST_MATH_STANDALONE +#include +#ifdef BOOST_NO_CXX17_IF_CONSTEXPR +#error "The header can only be used in C++17 and later." +#endif +#endif + namespace boost::math::ccmath { namespace detail { diff --git a/include/boost/math/ccmath/signbit.hpp b/include/boost/math/ccmath/signbit.hpp index 5e94496440..4c7bf5b2c5 100644 --- a/include/boost/math/ccmath/signbit.hpp +++ b/include/boost/math/ccmath/signbit.hpp @@ -16,6 +16,14 @@ #include #include +#include +#ifndef BOOST_MATH_STANDALONE +#include +#ifdef BOOST_NO_CXX17_IF_CONSTEXPR +#error "The header can only be used in C++17 and later." +#endif +#endif + #ifdef __has_include # if __has_include() # include diff --git a/include/boost/math/differentiation/lanczos_smoothing.hpp b/include/boost/math/differentiation/lanczos_smoothing.hpp index a314288e48..1f18c2f6d5 100644 --- a/include/boost/math/differentiation/lanczos_smoothing.hpp +++ b/include/boost/math/differentiation/lanczos_smoothing.hpp @@ -14,6 +14,14 @@ #include #include +#include +#ifndef BOOST_MATH_STANDALONE +#include +#ifdef BOOST_NO_CXX17_IF_CONSTEXPR +#error "The header can only be used in C++17 and later." +#endif +#endif + namespace boost::math::differentiation { namespace detail { diff --git a/include/boost/math/distributions/empirical_cumulative_distribution_function.hpp b/include/boost/math/distributions/empirical_cumulative_distribution_function.hpp index ac1e4bee08..767ea2e323 100644 --- a/include/boost/math/distributions/empirical_cumulative_distribution_function.hpp +++ b/include/boost/math/distributions/empirical_cumulative_distribution_function.hpp @@ -11,6 +11,14 @@ #include #include +#include +#ifndef BOOST_MATH_STANDALONE +#include +#ifdef BOOST_NO_CXX17_IF_CONSTEXPR +#error "The header can only be used in C++17 and later." +#endif +#endif + namespace boost { namespace math{ template diff --git a/include/boost/math/filters/daubechies.hpp b/include/boost/math/filters/daubechies.hpp index 0dc4b5bf5c..0fdeac6a34 100644 --- a/include/boost/math/filters/daubechies.hpp +++ b/include/boost/math/filters/daubechies.hpp @@ -10,6 +10,14 @@ #include #include +#include +#ifndef BOOST_MATH_STANDALONE +#include +#ifdef BOOST_NO_CXX17_IF_CONSTEXPR +#error "The header can only be used in C++17 and later." +#endif +#endif + namespace boost::math::filters { template diff --git a/include/boost/math/special_functions/daubechies_scaling.hpp b/include/boost/math/special_functions/daubechies_scaling.hpp index 503a5446e2..069b35a0ed 100644 --- a/include/boost/math/special_functions/daubechies_scaling.hpp +++ b/include/boost/math/special_functions/daubechies_scaling.hpp @@ -19,6 +19,14 @@ #include #include +#include +#ifndef BOOST_MATH_STANDALONE +#include +#ifdef BOOST_NO_CXX17_IF_CONSTEXPR +#error "The header can only be used in C++17 and later." +#endif +#endif + namespace boost::math { template diff --git a/include/boost/math/special_functions/daubechies_wavelet.hpp b/include/boost/math/special_functions/daubechies_wavelet.hpp index d1e3f5609b..d12a6df6b6 100644 --- a/include/boost/math/special_functions/daubechies_wavelet.hpp +++ b/include/boost/math/special_functions/daubechies_wavelet.hpp @@ -21,6 +21,14 @@ #include #include +#include +#ifndef BOOST_MATH_STANDALONE +#include +#ifdef BOOST_NO_CXX17_IF_CONSTEXPR +#error "The header can only be used in C++17 and later." +#endif +#endif + namespace boost::math { template diff --git a/include/boost/math/special_functions/rsqrt.hpp b/include/boost/math/special_functions/rsqrt.hpp index 3b8be82352..438d16fb0c 100644 --- a/include/boost/math/special_functions/rsqrt.hpp +++ b/include/boost/math/special_functions/rsqrt.hpp @@ -9,6 +9,14 @@ #include #include +#include +#ifndef BOOST_MATH_STANDALONE +#include +#ifdef BOOST_NO_CXX17_IF_CONSTEXPR +#error "The header can only be used in C++17 and later." +#endif +#endif + namespace boost::math { template diff --git a/include/boost/math/statistics/signal_statistics.hpp b/include/boost/math/statistics/signal_statistics.hpp index c11e802c30..ebde0f8bb2 100644 --- a/include/boost/math/statistics/signal_statistics.hpp +++ b/include/boost/math/statistics/signal_statistics.hpp @@ -13,6 +13,13 @@ #include #include +#include +#ifndef BOOST_MATH_STANDALONE +#include +#ifdef BOOST_NO_CXX17_IF_CONSTEXPR +#error "The header can only be used in C++17 and later." +#endif +#endif namespace boost::math::statistics { diff --git a/include/boost/math/tools/centered_continued_fraction.hpp b/include/boost/math/tools/centered_continued_fraction.hpp index 0493142de5..1bb095c8fd 100644 --- a/include/boost/math/tools/centered_continued_fraction.hpp +++ b/include/boost/math/tools/centered_continued_fraction.hpp @@ -18,6 +18,13 @@ #include #include +#ifndef BOOST_MATH_STANDALONE +#include +#ifdef BOOST_NO_CXX17_IF_CONSTEXPR +#error "The header can only be used in C++17 and later." +#endif +#endif + #ifndef BOOST_MATH_STANDALONE #include #endif diff --git a/include/boost/math/tools/condition_numbers.hpp b/include/boost/math/tools/condition_numbers.hpp index 8754d12828..5894f20b78 100644 --- a/include/boost/math/tools/condition_numbers.hpp +++ b/include/boost/math/tools/condition_numbers.hpp @@ -9,6 +9,14 @@ #include #include +#include +#ifndef BOOST_MATH_STANDALONE +#include +#ifdef BOOST_NO_CXX17_IF_CONSTEXPR +#error "The header can only be used in C++17 and later." +#endif +#endif + namespace boost::math::tools { template diff --git a/include/boost/math/tools/engel_expansion.hpp b/include/boost/math/tools/engel_expansion.hpp index 643d469dee..4e54988be8 100644 --- a/include/boost/math/tools/engel_expansion.hpp +++ b/include/boost/math/tools/engel_expansion.hpp @@ -14,6 +14,14 @@ #include #include +#include +#ifndef BOOST_MATH_STANDALONE +#include +#ifdef BOOST_NO_CXX17_IF_CONSTEXPR +#error "The header can only be used in C++17 and later." +#endif +#endif + namespace boost::math::tools { template diff --git a/include/boost/math/tools/luroth_expansion.hpp b/include/boost/math/tools/luroth_expansion.hpp index 7fb486b865..6cc6f9abdc 100644 --- a/include/boost/math/tools/luroth_expansion.hpp +++ b/include/boost/math/tools/luroth_expansion.hpp @@ -13,6 +13,14 @@ #include #include +#include +#ifndef BOOST_MATH_STANDALONE +#include +#ifdef BOOST_NO_CXX17_IF_CONSTEXPR +#error "The header can only be used in C++17 and later." +#endif +#endif + namespace boost::math::tools { template diff --git a/include/boost/math/tools/norms.hpp b/include/boost/math/tools/norms.hpp index 073ad80cfa..ad444bae42 100644 --- a/include/boost/math/tools/norms.hpp +++ b/include/boost/math/tools/norms.hpp @@ -12,6 +12,14 @@ #include #include +#include +#ifndef BOOST_MATH_STANDALONE +#include +#ifdef BOOST_NO_CXX17_IF_CONSTEXPR +#error "The header can only be used in C++17 and later." +#endif +#endif + namespace boost::math::tools { diff --git a/include/boost/math/tools/signal_statistics.hpp b/include/boost/math/tools/signal_statistics.hpp index d553192f01..382844c195 100644 --- a/include/boost/math/tools/signal_statistics.hpp +++ b/include/boost/math/tools/signal_statistics.hpp @@ -14,6 +14,14 @@ #include #include +#include +#ifndef BOOST_MATH_STANDALONE +#include +#ifdef BOOST_NO_CXX17_IF_CONSTEXPR +#error "The header can only be used in C++17 and later." +#endif +#endif + BOOST_MATH_HEADER_DEPRECATED(""); namespace boost::math::tools { diff --git a/include/boost/math/tools/simple_continued_fraction.hpp b/include/boost/math/tools/simple_continued_fraction.hpp index fad654533d..0fe17fc59d 100644 --- a/include/boost/math/tools/simple_continued_fraction.hpp +++ b/include/boost/math/tools/simple_continued_fraction.hpp @@ -14,7 +14,14 @@ #include #include #include + #include +#ifndef BOOST_MATH_STANDALONE +#include +#ifdef BOOST_NO_CXX17_IF_CONSTEXPR +#error "The header can only be used in C++17 and later." +#endif +#endif #ifndef BOOST_MATH_STANDALONE #include diff --git a/include/boost/math/tools/univariate_statistics.hpp b/include/boost/math/tools/univariate_statistics.hpp index 36f9d44fcf..1091d9f6e4 100644 --- a/include/boost/math/tools/univariate_statistics.hpp +++ b/include/boost/math/tools/univariate_statistics.hpp @@ -12,6 +12,14 @@ #include #include +#include +#ifndef BOOST_MATH_STANDALONE +#include +#ifdef BOOST_NO_CXX17_IF_CONSTEXPR +#error "The header can only be used in C++17 and later." +#endif +#endif + BOOST_MATH_HEADER_DEPRECATED(""); namespace boost::math::tools {