tlds
Transactional Operations for Linked Data Structures
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
assert.h
Go to the documentation of this file.
1
//------------------------------------------------------------------------------
2
//
3
//
4
//
5
//------------------------------------------------------------------------------
6
7
#ifndef _COMMON_UTILITIES_ASSERT_INCLUDED_
8
#define _COMMON_UTILITIES_ASSERT_INCLUDED_
9
10
#include "config.h"
11
12
//------------------------------------------------------------------------
13
// Assert is used to emit run time error
14
//------------------------------------------------------------------------
15
#if defined ENABLE_ASSERT
16
namespace
detail {
17
class
Assert
18
{
19
public
:
20
static
void
ConditionFailed(
const
char
* condition,
const
char
* message, ... );
21
};
22
}
23
24
#define ASSERT( condition, ... ) ( !(condition) ? detail::Assert::ConditionFailed( #condition, __VA_ARGS__ ) : ((void)0) )
25
#define ASSERT_CODE( assertCode ) assertCode
26
#else
27
#define ASSERT( condition, ... ) ((void)sizeof(condition))
28
#define ASSERT_CODE( assertCode )
29
#endif
30
31
//------------------------------------------------------------------------
32
//Static Assert used to emit compile time error
33
//------------------------------------------------------------------------
34
#ifdef ENABLE_STATIC_ASSERT
35
// Based on Loki library!
36
namespace
detail
37
{
38
template
<
int
>
39
struct
CompileTimeError;
40
41
template
<>
42
struct
CompileTimeError< true >{};
43
}
44
45
#define STATIC_ASSERT( expression, message ) \
46
{ detail::CompileTimeError<( (expression) != 0 ) > ERROR_##message; (void)ERROR_##message; }
47
#else
48
#define STATIC_ASSERT( expression, message ) ((void)0)
49
#endif
50
51
#endif //_COMMON_UTILITIES_ASSERT_INCLUDED_
common
assert.h
Generated on Thu Sep 8 2016 13:28:38 for tlds by
1.8.6