PCRE2 C++ Wrapper 1.3.0
pcre2cpp
Loading...
Searching...
No Matches
assert.hpp
1/*
2 * pcre2cpp - PCRE2 cpp wrapper
3 *
4 * Licensed under the BSD 3-Clause License with Attribution Requirement.
5 * See the LICENSE file for details: https://github.com/MAIPA01/pcre2cpp/blob/main/LICENSE
6 *
7 * Copyright (c) 2025, Patryk Antosik (MAIPA01)
8 *
9 * PCRE2 library included in this project:
10 * Copyright (c) 2016-2024, University of Cambridge.
11 *
12 * See the LICENSE_PCRE2 file for details: https://github.com/MAIPA01/pcre2cpp/blob/main/LICENSE_PCRE2
13 */
14
15
16#pragma once
17#ifndef _PCRE2CPP_ASSERT_HPP_
18 #define _PCRE2CPP_ASSERT_HPP_
19
20 #include <pcre2cpp/config.hpp>
21
23_PCRE2CPP_ERROR("This is only available for c++17 and greater and when asserts are enabled!");
24 #else
25
26 #include <mstd/mstd.hpp>
27
28 /**
29 * @def pcre2cpp_assert(expression, ...)
30 * @brief pcre2cpp assert
31 * @ingroup utils
32 */
33
34 #if _DEBUG
35 #define pcre2cpp_assert(expression, ...)
36 MSTD_STOP_ASSERT_BASE(expression, [](const std::string_view) -> void {} __VA_OPT__(, ) __VA_ARGS__)
37 #elif !defined(PCRE2CPP_DISABLE_ASSERT_ON_RELEASE)
38 #define pcre2cpp_assert(expression, ...)
39 MSTD_LOG_ASSERT_BASE(expression, [](const std::string_view) -> void {} __VA_OPT__(, ) __VA_ARGS__)
40 #else
41 #define pcre2cpp_assert(expression, ...)
42 MSTD_EMPTY_ASSERT_BASE(expression, [](const std::string_view) -> void {} __VA_OPT__(, ) __VA_ARGS__)
43 #endif
44
45 #endif
46#endif
#define _PCRE2CPP_HAS_ASSERTS
check if asserts are enabled
Definition config.hpp:172