summaryrefslogtreecommitdiffstats
path: root/ext/sqlite_modern_cpp/sqlite_modern_cpp/utility/uncaught_exceptions.h
diff options
context:
space:
mode:
Diffstat (limited to 'ext/sqlite_modern_cpp/sqlite_modern_cpp/utility/uncaught_exceptions.h')
-rw-r--r--ext/sqlite_modern_cpp/sqlite_modern_cpp/utility/uncaught_exceptions.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/ext/sqlite_modern_cpp/sqlite_modern_cpp/utility/uncaught_exceptions.h b/ext/sqlite_modern_cpp/sqlite_modern_cpp/utility/uncaught_exceptions.h
new file mode 100644
index 0000000..17d6326
--- /dev/null
+++ b/ext/sqlite_modern_cpp/sqlite_modern_cpp/utility/uncaught_exceptions.h
@@ -0,0 +1,27 @@
+#pragma once
+
+#include <cassert>
+#include <exception>
+#include <iostream>
+
+namespace sqlite {
+ namespace utility {
+#ifdef __cpp_lib_uncaught_exceptions
+ class UncaughtExceptionDetector {
+ public:
+ operator bool() {
+ return count != std::uncaught_exceptions();
+ }
+ private:
+ int count = std::uncaught_exceptions();
+ };
+#else
+ class UncaughtExceptionDetector {
+ public:
+ operator bool() {
+ return std::uncaught_exception();
+ }
+ };
+#endif
+ }
+}