std::is_destructible, std::is_trivially_destructible, std::is_nothrow_destructible
De cppreference.com.
|
|
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
| Défini dans l'entête <type_traits>
|
||
| template< class T > struct is_destructible; |
(1) | (depuis C++11) |
| template< class T > struct is_trivially_destructible; |
(2) | (depuis C++11) |
| template< class T > struct is_nothrow_destructible; |
(3) | (depuis C++11) |
Si une structure imaginaire contenant un objet membre de
2) T type a un destructeur non supprimé, assure le membre de constante value true égale. Pour tout autre type, value est false .Original:
If an imaginary struct containing a member object of type
T has a non-deleted destructor, provides the member constant value equal true. For any other type, value is false.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
même que 1), mais le destructeur n'appelle pas une opération qui n'est pas anodin .
3) Original:
same as 1), but the destructor does not call any operation that is not trivial.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
même que 1), mais le destructeur est noexcept .
Original:
same as 1), but the destructor is noexcept.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Sommaire |
Inherited from std::integral_constant
Member constants
| value [ statique ]Original: static The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
true si T is destructible, false autrement Original: true if T is destructible, false otherwise The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (constante membre statique publique) |
Member functions
| operator bool |
convertit l'objet en bool, retourne value Original: converts the object to bool, returns value The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction membre publique) |
Member types
| Type d'
Original: Type The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
Definition |
value_type
|
bool
|
type
|
std::integral_constant<bool, value> |
[modifier] Notes
Parce que le programme C + + prend fin si un destructeur lève une exception lors de la pile de déroulement (qui ne peut généralement pas être prédite), tous les destructeurs pratiques sont non-lancer, même si elles ne sont pas déclarées noexcept. Tous les destructeurs trouvés dans la bibliothèque standard C + + ne sont pas des jets de .
Original:
Because the C++ program terminates if a destructor throws an exception during stack unwinding (which usually cannot be predicted), all practical destructors are non-throwing even if they are not declared noexcept. All destructors found in the C++ standard library are non-throwing.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[modifier] Exemple
#include <iostream> #include <string> #include <type_traits> struct Foo { std::string str; ~Foo() noexcept {}; }; struct Bar { ~Bar() = default; }; int main() { std::cout << std::boolalpha << "std::string is destructible? " << std::is_destructible<std::string>::value << '\n' << "Foo is nothrow destructible? " << std::is_nothrow_destructible<Foo>::value << '\n' << "Bar is trivally destructible? " << std::is_trivially_destructible<Bar>::value << '\n'; }
Résultat :
std::string is destructible? true Foo is nothrow destructible? true Bar is trivally destructible? true
[modifier] Voir aussi
| (C++11) (C++11) (C++11) |
vérifie si un type a un constructeur pour les arguments spécifiques Original: checks if a type has a constructor for specific arguments The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (classe générique) |
| (C++11) |
vérifie si un type a un destructeur virtuel Original: checks if a type has a virtual destructor The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (classe générique) |