Megosztás a következőn keresztül:


domain_error Class

The class serves as the base class for all exceptions thrown to report a domain error.

class domain_error : public logic_error {
public:
    explicit domain_error(const string& message);
    explicit domain_error(const char *message);
};

Remarks

The value returned by exception Class is a copy of message.data.

Example

// domain_error.cpp
// compile with: /EHsc /GR
#include <iostream>

using namespace std;

int main( )
{
   try 
   {
      throw domain_error( "Your domain is in error!" );
   }
   catch (exception &e) 
   {
      cerr << "Caught: " << e.what( ) << endl;
      cerr << "Type: " << typeid(e).name( ) << endl;
   };
}
Caught: Your domain is in error!
Type: class std::domain_error

Requirements

Header: <stdexcept>

Namespace: std

See Also

Reference

logic_error Class

Thread Safety in the C++ Standard Library