Condividi tramite


Classe range_error

La classe funge da classe base per tutte le eccezioni generate per segnalare un errore di intervallo.

class range_error : public runtime_error {
public:
    explicit range_error(const string& message);
    explicit range_error(const char *message);
};

Note

Il valore restituito da Classe exception è una copia di messaggio.dati.

Esempio

// range_error.cpp
// compile with: /EHsc /GR
#include <iostream>
using namespace std;
int main()
{
   try 
   {
      throw range_error( "The range is in error!" );
   }
   catch (exception &e) 
   {
      cerr << "Caught: " << e.what( ) << endl;
      cerr << "Type: " << typeid( e ).name( ) << endl;
   };
}
  

Requisiti

stdexcept<diIntestazione: >

Spazio dei nomi: std

Vedere anche

Riferimenti

Classe runtime_error

Sicurezza dei thread nella libreria standard C++