out_of_range — Klasa

Klasa służy jako klasa podstawowa dla wszystkich wyjątków odrzuconych zgłosić argumentem jest poza prawidłowym zakresem.

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

Uwagi

Wartość zwracana przez exception — Klasa jest kopią wiadomość.danych.

Przykład

// out_of_range.cpp
// compile with: /EHsc
#include <string>
#include <iostream>

using namespace std;

int main() {
// out_of_range
   try {
      string str( "Micro" );
      string rstr( "soft" );
      str.append( rstr, 5, 3 );
      cout << str << endl;
   }
   catch ( exception &e ) {
      cerr << "Caught: " << e.what( ) << endl;
   };
}

Dane wyjściowe

Caught: invalid string position

Wymagania

Nagłówek: <stdexcept>

Przestrzeń nazw: std

Zobacz też

Informacje

logic_error — Klasa

Bezpieczeństwo wątku w standardowej bibliotece C++