opynsim
Unofficial C++ Documentation
Loading...
Searching...
No Matches
assertions.h
Go to the documentation of this file.
1#pragma once
2
4#include <liboscar/oscar_config.h>
5
6#include <string_view>
7
8namespace osc::detail
9{
10 // calls into (hidden) assertion-handling implementation
12 std::string_view failing_code,
13 std::string_view function_name,
14 std::string_view file_name,
15 unsigned int file_line
16 );
17}
18
19// always execute this assertion - even if in release mode /w debug flags disabled
20#define OSC_ASSERT_ALWAYS(expr) \
21 (static_cast<bool>(expr) ? static_cast<void>(0) : osc::detail::on_assertion_failure(#expr, static_cast<const char*>(__func__), osc::extract_filename(__FILE__), __LINE__))
22
23#if OPYN_FORCE_ASSERTS_ENABLED
24 #define OSC_ASSERT(expr) OSC_ASSERT_ALWAYS(expr)
25#elif !defined(NDEBUG)
26 #define OSC_ASSERT(expr) OSC_ASSERT_ALWAYS(expr)
27#else
28 #define OSC_ASSERT(expr)
29#endif
Definition range_with_size_greater_than.h:11
void on_assertion_failure(std::string_view failing_code, std::string_view function_name, std::string_view file_name, unsigned int file_line)
constexpr U to(T &&value)
Definition conversion.h:56