1 #pragma once // Source encoding: UTF-8 with BOM (π is a lowercase Greek "pi"). 13 inline namespace hopefully_and_fail {}
17 CPPX_USE_STD( current_exception, runtime_error,
string, throw_with_nested );
48 template<
class X = runtime_error >
50 inline auto fail(
const string& message )
56 const Truth in_exception_handling = (std::current_exception() !=
nullptr);
57 if( in_exception_handling )
59 throw_with_nested( X( message ) );
67 template<
class X = runtime_error >
73 + throw_point.function_name_or_unspecified() +
" - " + message +
"\n" 74 + string( 4,
' ' ) +
">" + throw_point.file_and_line()
99 template<
class Value >
102 {
return not (v >>
Success{}); }
105 inline namespace hopefully_and_fail {
112 using hf::operator>>;
auto fail(const string &message) -> Truth
A drop-in replacement for bool without implicit conversion from/to types other than bool.
CPPX_USE_STD(current_exception, runtime_error, string, throw_with_nested)
auto hopefully(const Truth condition) -> Truth
Truth is a drop-in replacement for bool without implicit conversion from/to types other than bool.
auto operator>>(const Value &v, Failure) -> Truth