Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

missing version macros #478

Open
gpeterhoff opened this issue Jun 15, 2023 · 0 comments
Open

missing version macros #478

gpeterhoff opened this issue Jun 15, 2023 · 0 comments

Comments

@gpeterhoff
Copy link

Hello,
I miss these macros in boost/config.hpp:

  • BOOST_NO_CXX20/BOOST_NO_CXX23 (like BOOST_NO_CXX14, BOOST_NO_CXX17)
  • BOOST_CXX17_CONSTEXPR/BOOST_CXX20_CONSTEXPR/BOOST_CXX23_CONSTEXPR (like BOOST_CXX14_CONSTEXPR)
  • BOOST_CXX20_CONSTEVAL/BOOST_CXX23_CONSTEVAL

This could be done like this:
// C++17
#if defined(__cpp_constexpr)
#if (__cpp_constexpr < 201603L)
#define BOOST_NO_CXX17_CONSTEXPR
#endif
#else
#define BOOST_NO_CXX17_CONSTEXPR
#endif

#if defined(BOOST_NO_CXX17_CONSTEXPR)
#define BOOST_CXX17_CONSTEXPR
#else
#define BOOST_CXX17_CONSTEXPR constexpr
#endif

// C++20
#if (BOOST_CXX_VERSION < 202002L)
#define BOOST_NO_CXX20
#endif

#if defined(__cpp_constexpr)
#if (__cpp_constexpr < 202002L)
#define BOOST_NO_CXX20_CONSTEXPR
#endif
#else
#define BOOST_NO_CXX20_CONSTEXPR
#endif

#if defined(BOOST_NO_CXX20_CONSTEXPR)
#define BOOST_CXX20_CONSTEXPR
#else
#define BOOST_CXX20_CONSTEXPR constexpr
#endif

#if defined(__cpp_consteval)
#if (__cpp_consteval < 201811L)
#define BOOST_CXX20_NO_CONSTEVAL
#endif
#else
#define BOOST_CXX20_NO_CONSTEVAL
#endif

#if defined(BOOST_CXX20_NO_CONSTEVAL)
#define BOOST_CXX20_CONSTEVAL
#else
#define BOOST_CXX20_CONSTEVAL consteval
#endif

// C++23
#if (BOOST_CXX_VERSION < 202100L)
#define BOOST_NO_CXX23
#endif

#if defined(__cpp_constexpr)
#if (__cpp_constexpr < 202211L)
#define BOOST_NO_CXX23_CONSTEXPR
#endif
#else
#define BOOST_NO_CXX23_CONSTEXPR
#endif

#if defined(BOOST_NO_CXX23_CONSTEXPR)
#define BOOST_CXX23_CONSTEXPR
#else
#define BOOST_CXX23_CONSTEXPR constexpr
#endif

#if defined(__cpp_consteval)
#if (__cpp_consteval < 202211L)
#define BOOST_CXX23_NO_CONSTEVAL
#endif
#else
#define BOOST_CXX23_NO_CONSTEVAL
#endif

#if defined(BOOST_CXX23_NO_CONSTEVAL)
#define BOOST_CXX23_CONSTEVAL
#else
#define BOOST_CXX23_CONSTEVAL consteval
#endif

thx
Gero

@gpeterhoff gpeterhoff changed the title missing macros missing version macros Jun 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant