std::bad_typeid - cppreference.com
Da cppreference.com.
|
|
Questa pagina è stata tradotta in modo automatico dalla versione in ineglese della wiki usando Google Translate. La traduzione potrebbe contenere errori e termini strani. Muovi il puntatore sopra al testo per vedere la versione originale. Puoi aiutarci a correggere gli gli errori. Per ulteriori istruzioni clicca qui. |
<metanoindex/>
<tbody> </tbody>
| Elemento definito nell'header <typeinfo> |
||
|
|
||
Un'eccezione di questo tipo viene generata quando un operatore
typeidviene applicato ad un valore nullo dereferenziate puntatore o un tipo polimorfico.
Original:
An exception of this type is thrown when a
typeidoperator is applied to a dereferenced null pointer value or a polymorphic type.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Inheritance diagram
Membri funzioni
costruisce un nuovo oggetto Original: constructs a new The text has been machine-translated via Google Translate. (metodo pubblico) | |
Inherited from std::exception
Member functions
distrugge l'oggetto eccezione Original: destructs the exception object The text has been machine-translated via Google Translate. (metodo pubblico virtuale) [modifica] | |
restituisce una stringa esplicativa Original: returns an explanatory string The text has been machine-translated via Google Translate. (metodo pubblico virtuale) [modifica] | |
Esempio
#include <iostream> #include <typeinfo> struct S { // The type has to be polymorphic virtual void f(); }; int main() { S* p = nullptr; try { std::cout << typeid(*p).name() << '\n'; } catch(const std::bad_typeid& e) { std::cout << e.what() << '\n'; } }
Output:
Attempted a typeid of NULL pointer!