◐ Shell
clean mode source ↗

typeid operator — cppreference.com

De cppreference.com

<metanoindex/>

Requêtes informations d'un type .

Original:

Queries information of a type.

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Utilisé lorsque le type réel d'une classe de base virtuel doit être connu .

Original:

Used where the actual type of a virtuel base class must be known.

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Syntaxe

typeid( type ) (1)
typeid( expression ) (2)

<typeinfo>-tête doit être inclus avant d'utiliser l'opérateur typeid .

Original:

Header <typeinfo> must be included before using typeid operator.

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Les deux versions renvoyer un objet de type .. const std::type_info&

Original:

Both versions return an object of type const std::type_info&.

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Explication

1)

renvoie les informations sur le type de type. Le type sera définitivement connu moment de la compilation, sans temps d'exécution est due .

Original:

returns the type information about the type. The type will be definitely known compile time and no runtime overhead is caused.

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

2)

expression est évaluée et l'information de type correspondant à la valeur résultante est retournée. Si le expression est dans une classe de base virtuelle, le type réel de la classe est interrogé de façon dynamique avec une surcharge d'exécution. Sinon, le type réel est temps de compilation définitivement connu, sans temps d'exécution est due .

Original:

expression is evaluated and type information corresponding to the resulting value is returned. If the expression is in a virtual base class, the actual type of the class is queried dynamically with some runtime overhead. Otherwise the actual type is definitely known compile time and no runtime overhead is caused.

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Mots-clés

typeid

Exemple