mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-02-01 03:20:41 +00:00
compat.h: Add some infrastructure for C++ template metaprogramming.
git-svn-id: https://svn.eduke32.com/eduke32@6117 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
a1f317ecfc
commit
7a40df33b6
1 changed files with 43 additions and 0 deletions
|
@ -197,6 +197,12 @@
|
||||||
# define CONSTEXPR
|
# define CONSTEXPR
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if CXXSTD >= 2011
|
||||||
|
# define FINAL final
|
||||||
|
#else
|
||||||
|
# define FINAL
|
||||||
|
#endif
|
||||||
|
|
||||||
#if CXXSTD >= 2014
|
#if CXXSTD >= 2014
|
||||||
# define CONSTEXPR_CXX14 CONSTEXPR
|
# define CONSTEXPR_CXX14 CONSTEXPR
|
||||||
#else
|
#else
|
||||||
|
@ -345,6 +351,11 @@ defined __x86_64__ || defined __amd64__ || defined _M_X64 || defined _M_IA64 ||
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
# if CXXSTD >= 2011
|
||||||
|
# include <type_traits>
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
////////// Platform headers //////////
|
////////// Platform headers //////////
|
||||||
|
|
||||||
|
@ -621,8 +632,40 @@ void eduke32_exit_return(int) ATTRIBUTE((noreturn));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
////////// Metaprogramming structs //////////
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
|
||||||
|
# if CXXSTD >= 2011
|
||||||
|
using std::is_integral;
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# if CXXSTD >= 2014
|
||||||
|
using std::enable_if_t;
|
||||||
|
using std::conditional_t;
|
||||||
|
# elif CXXSTD >= 2011
|
||||||
|
template <bool B, class T = void>
|
||||||
|
using enable_if_t = typename std::enable_if<B, T>::type;
|
||||||
|
template<bool B, class T, class F>
|
||||||
|
using conditional_t = typename std::conditional<B, T, F>::type;
|
||||||
|
# endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
////////// Typedefs //////////
|
////////// Typedefs //////////
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
// for use in SFINAE constructs in place of the pointer trick (to which 0 can unintentionally be implicitly cast)
|
||||||
|
struct Dummy FINAL
|
||||||
|
{
|
||||||
|
FORCE_INLINE CONSTEXPR Dummy() : dummy(0) { }
|
||||||
|
|
||||||
|
private:
|
||||||
|
char dummy;
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int32_t x, y;
|
int32_t x, y;
|
||||||
} vec2_t;
|
} vec2_t;
|
||||||
|
|
Loading…
Reference in a new issue