Sleipnir C++ API
Loading...
Searching...
No Matches
assert.hpp
1// Copyright (c) Sleipnir contributors
2
3#pragma once
4
5#ifdef JORMUNGANDR
6#include <format>
7#include <source_location>
8#include <stdexcept>
12#define slp_assert(condition) \
13 do { \
14 if (!(condition)) { \
15 auto location = std::source_location::current(); \
16 throw std::invalid_argument(std::format( \
17 "{}:{}: {}: Assertion `{}' failed.", location.file_name(), \
18 location.line(), location.function_name(), #condition)); \
19 } \
20 } while (0);
21#else
22#include <cassert>
26#define slp_assert(condition) assert(condition)
27#endif