numerical-collection-cpp 0.10.0
A collection of algorithms in numerical analysis implemented in C++
Loading...
Searching...
No Matches
assert.h File Reference

Definition of assertion macros. More...

#include <cstdio>
#include <cstdlib>
#include <string_view>
#include <fmt/base.h>
#include "num_collect/util/source_info_view.h"
+ Include dependency graph for assert.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  num_collect
 Namespace of num_collect source codes.
 
namespace  num_collect::util
 Namespace of utilities.
 
namespace  num_collect::util::impl
 Namespace of internal implementations.
 

Macros

#define NUM_COLLECT_ASSERT(CONDITION)
 Macro to check whether a condition is satisfied.
 
#define NUM_COLLECT_ASSERT_IMPL(CONDITION)
 Macro to check whether a condition is satisfied.
 
#define NUM_COLLECT_DEBUG_ASSERT(CONDITION)
 Macro to check whether a condition is satisfied in debug build only.
 

Functions

void num_collect::util::impl::handle_assertion_failure (std::string_view condition_str, source_info_view source=source_info_view())
 Handle a failure of an assertion.
 

Detailed Description

Definition of assertion macros.

Definition in file assert.h.

Macro Definition Documentation

◆ NUM_COLLECT_ASSERT

#define NUM_COLLECT_ASSERT ( CONDITION)
Value:
/* NOLINT */ \
NUM_COLLECT_ASSERT_IMPL(CONDITION) /* NOLINT */

Macro to check whether a condition is satisfied.

Parameters
[in]CONDITIONCondition.

Definition at line 66 of file assert.h.

◆ NUM_COLLECT_ASSERT_IMPL

#define NUM_COLLECT_ASSERT_IMPL ( CONDITION)
Value:
/* NOLINT */ \
do { /* NOLINT */ \
if (!(CONDITION)) [[unlikely]] { \
::num_collect::util::impl::handle_assertion_failure((#CONDITION)); \
} \
} while (false) /* NOLINT */

Macro to check whether a condition is satisfied.

Parameters
[in]CONDITIONCondition.

Definition at line 54 of file assert.h.

◆ NUM_COLLECT_DEBUG_ASSERT

#define NUM_COLLECT_DEBUG_ASSERT ( CONDITION)
Value:
#define NUM_COLLECT_ASSERT(CONDITION)
Macro to check whether a condition is satisfied.
Definition assert.h:66

Macro to check whether a condition is satisfied in debug build only.

Parameters
[in]CONDITIONCondition.

Definition at line 75 of file assert.h.