From: Matthias Maier Date: Sun, 24 May 2020 17:02:36 +0000 (-0500) Subject: base/std_cxx17: Make selection of boost/std a configure time constant X-Git-Tag: v9.3.0-rc1~1565^2~2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=59664e348395ab0d4c854057bec0e665700fd0a9;p=dealii.git base/std_cxx17: Make selection of boost/std a configure time constant Closes #10340 --- diff --git a/cmake/checks/check_01_cxx_features.cmake b/cmake/checks/check_01_cxx_features.cmake index 11b1789e1b..88b5ed6541 100644 --- a/cmake/checks/check_01_cxx_features.cmake +++ b/cmake/checks/check_01_cxx_features.cmake @@ -64,12 +64,22 @@ MACRO(_test_cxx17_support) # Test that the c++17 attributes are supported. CHECK_CXX_SOURCE_COMPILES( " + #include #include + #include + #include #if __cplusplus < 201703L && !defined(_MSC_VER) && !defined(__INTEL_COMPILER) # error \"insufficient support for C++17\" #endif + //check for some C++17 features that we use in our headers: + using std::apply; + using std::cyl_bessel_j; + using std::cyl_bessel_jf; + using std::cyl_bessel_jl; + using std::optional; + [[nodiscard]] int test_nodiscard() { return 1; diff --git a/include/deal.II/base/std_cxx17/cmath.h b/include/deal.II/base/std_cxx17/cmath.h index 9f31ca4239..6695379d2c 100644 --- a/include/deal.II/base/std_cxx17/cmath.h +++ b/include/deal.II/base/std_cxx17/cmath.h @@ -17,16 +17,17 @@ #include -#ifndef __cpp_lib_math_special_functions +#ifdef DEAL_II_HAVE_CXX17 +# include +#else # include -#endif // __cpp_lib_math_special_functions +#endif -#include DEAL_II_NAMESPACE_OPEN namespace std_cxx17 { -#ifndef __cpp_lib_math_special_functions +#ifndef DEAL_II_HAVE_CXX17 double (&cyl_bessel_j)(double, double) = boost::math::cyl_bessel_j; float (&cyl_bessel_jf)(float, @@ -37,7 +38,7 @@ namespace std_cxx17 using std::cyl_bessel_j; using std::cyl_bessel_jf; using std::cyl_bessel_jl; -#endif // __cpp_lib_math_special_functions +#endif } // namespace std_cxx17 DEAL_II_NAMESPACE_CLOSE diff --git a/include/deal.II/base/std_cxx17/optional.h b/include/deal.II/base/std_cxx17/optional.h index 52001f9fbc..3c9fa30b31 100644 --- a/include/deal.II/base/std_cxx17/optional.h +++ b/include/deal.II/base/std_cxx17/optional.h @@ -17,7 +17,7 @@ #include -#ifdef __cpp_lib_optional +#ifdef DEAL_II_HAVE_CXX17 # include #else # include @@ -26,10 +26,10 @@ DEAL_II_NAMESPACE_OPEN namespace std_cxx17 { -#ifdef __cpp_lib_optional - using std::optional; -#else +#ifndef DEAL_II_HAVE_CXX17 using boost::optional; +#else + using std::optional; #endif } // namespace std_cxx17 DEAL_II_NAMESPACE_CLOSE diff --git a/include/deal.II/base/std_cxx17/tuple.h b/include/deal.II/base/std_cxx17/tuple.h index 878bf6b357..93474c521e 100644 --- a/include/deal.II/base/std_cxx17/tuple.h +++ b/include/deal.II/base/std_cxx17/tuple.h @@ -19,14 +19,10 @@ #include -#ifndef __cpp_lib_apply -# include -#endif // __cpp_lib_apply - DEAL_II_NAMESPACE_OPEN namespace std_cxx17 { -#ifndef __cpp_lib_apply +#ifndef DEAL_II_HAVE_CXX17 template auto apply_impl(F &&fn, Tuple &&t, std::index_sequence) @@ -51,7 +47,7 @@ namespace std_cxx17 } #else using std::apply; -#endif // __cpp_lib_apply +#endif } // namespace std_cxx17 DEAL_II_NAMESPACE_CLOSE