Skip to content

Commit

Permalink
Utility: add a macro for conditional compilation
Browse files Browse the repository at this point in the history
This is useful for Magnum vectors.
  • Loading branch information
sthalik committed Oct 10, 2022
1 parent 9e35d4e commit 7220cb9
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Corrade/Utility/Macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -394,12 +394,18 @@ Expands to @cpp constexpr @ce on C++14 and newer, empty on C++11. Useful for
selectively marking functions that make use of C++14 relaxed constexpr rules.
@see @ref CORRADE_CXX_STANDARD
*/
#if CORRADE_CXX_STANDARD >= 201402
#if __cpp_constexpr >= 201304
#define CORRADE_CONSTEXPR14 constexpr
#else
#define CORRADE_CONSTEXPR14
#endif

#if defined(__clang__) && __clang_major__ >= 9 || defined(__GNUG__) && __GNUG__ >= 9 || defined(_MSC_VER) && _MSC_VER >= 1931
#define CORRADE_CONSTEVAL (__builtin_is_constant_evaluated())
#elif CORRADE_CXX_STANDARD >= 202002L
#define CORRADE_CONSTEVAL (std::is_constant_evaluated()) /*include type_traits*/
#endif

/** @hideinitializer
@brief Always inline a function
@m_since{2019,10}
Expand Down

0 comments on commit 7220cb9

Please sign in to comment.