cpp-common/vendor: add copy of wise_enum
[babeltrace.git] / src / cpp-common / vendor / wise-enum / optional_common.h
1 #pragma once
2
3 #ifdef WISE_ENUM_NO_EXCEPT
4
5 #include <cstdlib>
6 #define WISE_ENUM_OPTIONAL_BAD_ACCESS std::abort()
7
8 #else
9
10 #include <stdexcept>
11
12 namespace wise_enum {
13
14 struct bad_optional_access : std::exception {
15 const char *what() const noexcept override {
16 return "Error, attempt to access valueless optional!";
17 }
18 };
19 } // namespace wise_enum
20
21 #define WISE_ENUM_OPTIONAL_BAD_ACCESS throw bad_optional_access{}
22
23 #endif
This page took 0.031892 seconds and 4 git commands to generate.