Clustering
C++20 header-only: DBSCAN, HDBSCAN, k-means.
Loading...
Searching...
No Matches
always_assert.h
Go to the documentation of this file.
1#pragma once
2
3#include <cstdio>
4#include <cstdlib>
5
6namespace clustering {
7
16[[noreturn]] inline void alwaysAssertFail(const char *cond, const char *file, int line) noexcept {
17 std::fprintf(stderr, "clustering: always-assert failed: %s at %s:%d\n", cond, file, line);
18 std::abort();
19}
20
21} // namespace clustering
22
30#define CLUSTERING_ALWAYS_ASSERT(cond) \
31 do { \
32 if (!(cond)) { \
33 ::clustering::alwaysAssertFail(#cond, __FILE__, __LINE__); \
34 } \
35 } while (0)
void alwaysAssertFail(const char *cond, const char *file, int line) noexcept
Emits a diagnostic to stderr and terminates via std::abort.