From c8657943c8155ff37deca951346e391861a398ad Mon Sep 17 00:00:00 2001 From: Matt Williams Date: Fri, 23 Nov 2012 11:51:55 +0000 Subject: [PATCH] Create polyvox_constexpr macros based on the detected features We now have a two new polyvox_ macros: * polyvox_constexpr which is 'constexpr' is supported and '' otherwise * polyvox_constexpr_const constexpr which is also 'constexpr' is supported but falls back to 'const' otherwise. These macros should be safe to use liberally without worrying about which compiler you're on. --- library/PolyVoxCore/include/PolyVoxCore/Impl/TypeDef.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/library/PolyVoxCore/include/PolyVoxCore/Impl/TypeDef.h b/library/PolyVoxCore/include/PolyVoxCore/Impl/TypeDef.h index 113ccfd8..20866217 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/Impl/TypeDef.h +++ b/library/PolyVoxCore/include/PolyVoxCore/Impl/TypeDef.h @@ -104,4 +104,12 @@ freely, subject to the following restrictions: //#define static_assert static_assert //we can use this #endif +#if defined(HAS_CXX11_CONSTEXPR) + #define polyvox_constexpr_const constexpr //constexpr which falls back to const + #define polyvox_constexpr constexpr //constexpr which falls back to nothing +#else + #define polyvox_constexpr_const const + #define polyvox_constexpr +#endif + #endif