qswiki/database/hdr/sqlite_modern_cpp/utility/uncaught_exceptions.h

35 行
484 B
C++

#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
} // namespace utility
} // namespace sqlite