STX  1.0.0
panic.h
Go to the documentation of this file.
1 
30 #pragma once
31 
32 #include "stx/report.h"
33 #include "stx/source_location.h"
34 
36 
41 void panic_handler(std::string_view const& info, ReportPayload const& payload,
42  SourceLocation const& location) noexcept;
43 
51 [[noreturn]] void begin_panic(std::string_view const& info,
52  ReportPayload const& payload,
53  SourceLocation const& location) noexcept;
54 
62 template <typename T>
63 [[noreturn]] STX_FORCE_INLINE void panic(
64  std::string_view const& info, T const& value,
65  SourceLocation const& location = SourceLocation::current()) noexcept {
66  begin_panic(info, ReportPayload(report_query >> value), location);
67 }
68 
69 template <typename T = void>
70 [[noreturn]] STX_FORCE_INLINE void panic(
71  std::string_view const& info = "explicit panic",
72  SourceLocation const& location = SourceLocation::current()) noexcept {
73  begin_panic(info, ReportPayload(SpanReport()), location);
74 }
75 
void panic_handler(std::string_view const &info, ReportPayload const &payload, SourceLocation const &location) noexcept
Definition: report.h:304
#define STX_FORCE_INLINE
Definition: config.h:254
void begin_panic(std::string_view const &info, ReportPayload const &payload, SourceLocation const &location) noexcept
STX_FORCE_INLINE void panic(std::string_view const &info="explicit panic", SourceLocation const &location=SourceLocation::current()) noexcept
Definition: panic.h:70
Definition: report.h:265
#define STX_END_NAMESPACE
Definition: config.h:329
constexpr ReportQuery const report_query
Tag value for dispatching reports.
Definition: report.h:58
Definition: source_location.h:48
#define STX_BEGIN_NAMESPACE
Definition: config.h:325