include
ecl
errors
compile_time_assert.hpp
Go to the documentation of this file.
1
10
/*****************************************************************************
11
** Ifdefs
12
*****************************************************************************/
13
14
#ifndef ECL_ERRORS_COMPILE_TIME_ASSERT_HPP_
15
#define ECL_ERRORS_COMPILE_TIME_ASSERT_HPP_
16
17
/*****************************************************************************
18
** Includes
19
*****************************************************************************/
20
21
#include "
macros.hpp
"
22
23
/*****************************************************************************
24
** Namespaces
25
*****************************************************************************/
26
27
namespace
ecl
{
28
29
30
/*****************************************************************************
31
** Classes
32
*****************************************************************************/
37
template
<
bool
>
struct
COMPILE_TIME_FAILURE;
38
39
template
<>
struct
COMPILE_TIME_FAILURE<true> {};
40
41
template
<
int
x>
struct
static_assert_test {};
42
43
};
// namespace ecl
60
#define ecl_compile_time_assert( logical_expression ) \
61
typedef ecl::static_assert_test<sizeof(ecl::COMPILE_TIME_FAILURE< static_cast<bool>(logical_expression) >)> JOIN(compile_time_check,__LINE__)
62
78
// If the (void)ERROR_##message is absent, we get unused variable warnings.
79
#define ecl_verbose_compile_time_assert( logical_expression, message ) \
80
{ \
81
ecl::COMPILE_TIME_FAILURE<( (logical_expression) != 0)> ERROR_##message; \
82
(void)ERROR_##message; \
83
}
84
85
#endif
/* ECL_ERRORS_COMPILE_TIME_ASSERT_HPP_ */
ecl
macros.hpp
Macros for error-checking and program termination.
ecl_errors
Author(s): Daniel Stonier
autogenerated on Mon Feb 28 2022 22:16:11