Namespaces
Variants

Standard library header <stdexcept>

From cppreference.net
Standard library headers

此头文件是 错误处理 库的组成部分。

目录

用于指示逻辑前提条件或类不变量违规的异常类
(类)
用于报告无效参数的异常类
(类)
用于报告定义域错误的异常类
(类)
用于报告尝试超出最大允许大小的异常类
(类)
用于报告超出预期范围参数的异常类
(类)
用于指示仅在运行时可检测条件的异常类
(类)
用于报告内部计算中范围错误的异常类
(类)
用于报告算术上溢的异常类
(类)
用于报告算术下溢的异常类
(类)

概要

namespace std {
  class logic_error;
  class domain_error;
  class invalid_argument;
  class length_error;
  class out_of_range;
  class runtime_error;
  class range_error;
  class overflow_error;
  class underflow_error;
}

std::logic_error

namespace std {
  class logic_error : public exception
  {
  public:
    constexpr explicit logic_error(const string& what_arg);
    constexpr explicit logic_error(const char* what_arg);
  };
}

std::domain_error

namespace std {
  class domain_error : public logic_error
  {
  public:
    constexpr explicit domain_error(const string& what_arg);
    constexpr explicit domain_error(const char* what_arg);
  };
}

std::invalid_argument

namespace std {
  class invalid_argument : public logic_error
  {
  public:
    constexpr explicit invalid_argument(const string& what_arg);
    constexpr explicit invalid_argument(const char* what_arg);
  };
}

std::length_error

namespace std {
  class length_error : public logic_error
  {
  public:
    constexpr explicit length_error(const string& what_arg);
    constexpr explicit length_error(const char* what_arg);
  };
}

std::out_of_range

namespace std {
  class out_of_range : public logic_error
  {
  public:
    constexpr explicit out_of_range(const string& what_arg);
    constexpr explicit out_of_range(const char* what_arg);
  };
}

std::runtime_error

namespace std {
  class runtime_error : public exception
  {
  public:
    constexpr explicit runtime_error(const string& what_arg);
    constexpr explicit runtime_error(const char* what_arg);
  };
}

std::range_error

namespace std {
  class range_error : public runtime_error
  {
  public:
    constexpr explicit range_error(const string& what_arg);
    constexpr explicit range_error(const char* what_arg);
  };
}

std::overflow_error

namespace std {
  class overflow_error : public runtime_error
  {
  public:
    constexpr explicit overflow_error(const string& what_arg);
    constexpr explicit overflow_error(const char* what_arg);
  };
}

std::underflow_error

namespace std {
  class underflow_error : public runtime_error
  {
  public:
    constexpr explicit underflow_error(const string& what_arg);
    constexpr explicit underflow_error(const char* what_arg);
  };
}

参见

标准库组件抛出异常的基类
(类)