2022-08-13 01:26:00 +00:00
|
|
|
// C++98 static assert
|
|
|
|
|
|
|
|
struct false_type {
|
2022-09-13 04:26:54 +00:00
|
|
|
static const int value = 0;
|
2022-08-13 01:26:00 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct true_type {
|
2022-09-13 04:26:54 +00:00
|
|
|
static const int value = 1;
|
2022-08-13 01:26:00 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
template < int A, int B >
|
|
|
|
struct _n_is_equal : false_type {};
|
|
|
|
|
|
|
|
template < int A >
|
|
|
|
struct _n_is_equal< A, A > : true_type {};
|
|
|
|
|
|
|
|
template < class T, int N >
|
|
|
|
struct check_sizeof : _n_is_equal< sizeof(T), N > {};
|
|
|
|
|
|
|
|
#ifdef __MWERKS__
|
2022-09-18 06:05:46 +00:00
|
|
|
#define CHECK_SIZEOF(cls, size) extern int cls##_check[check_sizeof< cls, size >::value];
|
2022-08-13 01:26:00 +00:00
|
|
|
#else
|
|
|
|
#define CHECK_SIZEOF(cls, size)
|
2022-09-18 06:05:46 +00:00
|
|
|
#endif
|