5#include "y3c/y3c-config.h"
11#include <unordered_map>
50 std::string &&
func, std::string &&
what,
90 : id(++last_exception_id), what(what) {
91 exceptions.emplace(
id,
93 std::move(func), std::move(what)));
98 : id(other.id), what(std::move(other.what)) {
117#define define_terminate_func(ub_name) \
118 class ub_name : public std::exception { \
120 ub_name() = default; \
121 const char *what() const noexcept override { return #ub_name; } \
123 template <typename... Args, typename = skip_trace_tag> \
124 [[noreturn]] void terminate_##ub_name(std::string func, Args &&...args) { \
125 if (throw_on_terminate) { \
128 do_terminate_with({terminate_type::ub_name, std::move(func), \
129 what::ub_name(std::forward<Args>(args)...)}); \
140#undef define_terminate_func
148#define y3c_assert_internal(cond) \
150 y3c::internal::terminate_internal(__func__, \
151 "asserion '" #cond "' failed"); \
185 "y3c::out_of_range", std::move(func),
186 internal::
what::ub_out_of_range(size, index)) {}
188 const char *
what() const noexcept
override {
y3cの例外クラスのベース。
Definition terminate.h:78
exception_base & operator=(exception_base &&)=delete
static std::unordered_map< int, terminate_detail > exceptions
Definition terminate.h:86
static std::atomic< int > last_exception_id
Definition terminate.h:85
exception_base(exception_base &&other)
Definition terminate.h:97
exception_base & operator=(const exception_base &)=delete
std::string what
Definition terminate.h:82
exception_base(const char *e_class, std::string &&func, std::string &&what, skip_trace_tag={})
Definition terminate.h:88
~exception_base()
Definition terminate.h:102
exception_base(const exception_base &)=delete
Definition terminate.h:134
Definition terminate.h:133
Definition terminate.h:136
Definition terminate.h:137
Definition terminate.h:138
Definition terminate.h:132
Definition terminate.h:135
Definition terminate.h:179
out_of_range(std::string func, std::size_t size, std::ptrdiff_t index, internal::skip_trace_tag={})
Definition terminate.h:181
const char * what() const noexcept override
Definition terminate.h:188
void link() noexcept
Definition terminate_detail.cc:7
void do_terminate_with(terminate_detail &&detail)
例外を表示して強制終了する
Definition final_message.cc:177
bool throw_on_terminate
Definition terminate_detail.cc:18
void terminate_internal(std::string func, std::string what, skip_trace_tag={})
Definition terminate.h:142
terminate_type
Definition terminate.h:29
void handle_final_terminate_message() noexcept
Definition final_message.cc:147
void link()
Definition terminate.h:167
Definition terminate.h:27
Definition terminate.h:42
std::shared_ptr< void > raw_trace
Definition terminate.h:47
terminate_type type
Definition terminate.h:43
const char * e_class
Definition terminate.h:44
std::string what
Definition terminate.h:46
terminate_detail(terminate_type type, std::string &&func, std::string &&what, skip_trace_tag={})
Definition terminate.h:52
std::string func
Definition terminate.h:45
#define define_terminate_func(ub_name)
Definition terminate.h:117
#define Y3C_CALL
Definition y3c-config.h:34
#define Y3C_DLL
Definition y3c-config.h:20