Initial Commit
This commit is contained in:
35
cpepetest1/demo_error.hpp
Normal file
35
cpepetest1/demo_error.hpp
Normal file
@@ -0,0 +1,35 @@
|
||||
// examples/demo_error.hpp -*-C++-*-
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
#ifndef INCLUDED_EXAMPLES_DEMO_ERROR
|
||||
#define INCLUDED_EXAMPLES_DEMO_ERROR
|
||||
|
||||
#include <string>
|
||||
#include <system_error>
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
namespace demo
|
||||
{
|
||||
inline constexpr int timeout{1};
|
||||
|
||||
inline auto category() -> std::error_category const&
|
||||
{
|
||||
struct category
|
||||
: std::error_category
|
||||
{
|
||||
auto name() const noexcept -> char const* override {
|
||||
return "demo-category";
|
||||
}
|
||||
auto message(int c) const noexcept -> std::string override {
|
||||
return c == 1? "timeout": "unknown";
|
||||
}
|
||||
};
|
||||
static category rc{};
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user