diff options
Diffstat (limited to 'src/include/span.hpp')
-rw-r--r-- | src/include/span.hpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/include/span.hpp b/src/include/span.hpp index 3df70b72..70d78205 100644 --- a/src/include/span.hpp +++ b/src/include/span.hpp @@ -52,6 +52,13 @@ struct Span void note(::std::function<void(::std::ostream&)> msg) const; }; -#define ERROR(span, code, msg) do { (span).error(code, [&](::std::ostream& os) { os << msg; }); throw ::std::runtime_error("Error fell through" #code); } while(0) -#define BUG(span, msg) do { (span).bug([&](::std::ostream& os) { os << msg; }); throw ::std::runtime_error("Bug fell through"); } while(0) +template<typename T> +struct Spanned +{ + Span m_span; + T m_item; +}; + +#define ERROR(span, code, msg) do { (Span()/*span*/).error(code, [&](::std::ostream& os) { os << msg; }); throw ::std::runtime_error("Error fell through" #code); } while(0) +#define BUG(span, msg) do { (Span()/*span*/).bug([&](::std::ostream& os) { os << msg; }); throw ::std::runtime_error("Bug fell through"); } while(0) |