halcheck 1.0
Loading...
Searching...
No Matches
raise.hpp
1#ifndef HALCHECK_LIB_RAISE_HPP
2#define HALCHECK_LIB_RAISE_HPP
3
10#include <stdexcept>
11
12namespace halcheck { namespace lib {
13
18struct raise {
24 template<typename T>
25 explicit raise(const T &value) {
26 throw value;
27 }
28
34 template<typename T>
35 [[noreturn]] operator T &() const { // NOLINT: raise can be converted to anything
36 throw std::runtime_error("halcheck::lib::raise: impossible");
37 }
38};
39
40}} // namespace halcheck::lib
41
42#endif
raise(const T &value)
Throws the given value.
Definition raise.hpp:25
A type for values that do not exist.
Definition raise.hpp:18