mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-27 06:48:31 +00:00
Add more CTL content
This commit is contained in:
parent
38921dc46b
commit
021c53ba32
56 changed files with 1747 additions and 298 deletions
33
ctl/runtime_error.h
Normal file
33
ctl/runtime_error.h
Normal file
|
@ -0,0 +1,33 @@
|
|||
// -*-mode:c++;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8-*-
|
||||
// vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :vi
|
||||
#ifndef CTL_RUNTIME_ERROR_H_
|
||||
#define CTL_RUNTIME_ERROR_H_
|
||||
#include "ctl/string.h"
|
||||
|
||||
namespace ctl {
|
||||
|
||||
class runtime_error
|
||||
{
|
||||
public:
|
||||
explicit runtime_error(const string& what_arg) : msg_(what_arg)
|
||||
{
|
||||
}
|
||||
|
||||
explicit runtime_error(const char* what_arg) : msg_(what_arg)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~runtime_error() noexcept = default;
|
||||
|
||||
virtual const char* what() const noexcept
|
||||
{
|
||||
return msg_.c_str();
|
||||
}
|
||||
|
||||
private:
|
||||
string msg_;
|
||||
};
|
||||
|
||||
} // namespace ctl
|
||||
|
||||
#endif // CTL_RUNTIME_ERROR_H_
|
Loading…
Add table
Add a link
Reference in a new issue