mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-24 21:10:33 +05:00
Exception ctor in cpp to reduce codesize
This commit is contained in:
parent
0ff62c6549
commit
648794b0bb
@ -18,6 +18,26 @@
|
||||
|
||||
namespace ngcore
|
||||
{
|
||||
|
||||
|
||||
Exception :: Exception(const std::string& s)
|
||||
: m_what(s) {}
|
||||
|
||||
Exception :: Exception(const char* s)
|
||||
: m_what(s) {}
|
||||
|
||||
|
||||
void ThrowException(const std::string & s)
|
||||
{
|
||||
throw Exception (s);
|
||||
}
|
||||
|
||||
void ThrowException(const char * s)
|
||||
{
|
||||
throw Exception (s);
|
||||
}
|
||||
|
||||
|
||||
namespace detail
|
||||
{
|
||||
static int exec(std::string cmd, std::string & out) {
|
||||
|
@ -31,8 +31,8 @@ namespace ngcore
|
||||
Exception() = default;
|
||||
Exception(const Exception&) = default;
|
||||
Exception(Exception&&) = default;
|
||||
Exception(const std::string& s) : m_what(s) {}
|
||||
Exception(const char* s) : m_what(s) {}
|
||||
Exception(const std::string& s); // : m_what(s) {}
|
||||
Exception(const char* s); // : m_what(s) {}
|
||||
~Exception() override = default;
|
||||
|
||||
Exception& operator =(const Exception&) = default;
|
||||
@ -50,6 +50,9 @@ namespace ngcore
|
||||
const char* what() const noexcept override { return m_what.c_str(); }
|
||||
};
|
||||
|
||||
NGCORE_API void ThrowException(const std::string & s);
|
||||
NGCORE_API void ThrowException(const char * s);
|
||||
|
||||
// Out of Range exception
|
||||
class NGCORE_API RangeException : public Exception
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user