std::is_destructible, std::is_trivially_destructible, std::is_nothrow_destructible
提供: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. |
| Defined in header <type_traits>
|
||
| template< class T > struct is_destructible; |
(1) | (C + + 11以来) |
| template< class T > struct is_trivially_destructible; |
(2) | (C + + 11以来) |
| template< class T > struct is_nothrow_destructible; |
(3) | (C + + 11以来) |
タイプ
2) Tのメンバオブジェクトを含む架空のstructは非削除デストラクタを持っている場合は、メンバーが一定提供value等しいtrueを。その他のタイプのために、valuefalseです.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.
1)と同じですが、デストラクタは簡単ではありません任意の操作を呼び出すことはありません.
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.
1)と同じですが、デストラクタは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.
目次 |
Inherited from std::integral_constant
Member constants
| value [静的] |
true T is destructibleもし、そうでなければfalse 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. (公共の静的メンバ定数) |
Member functions
| operator bool |
boolにオブジェクトは、 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. (パブリックメンバ関数) |
Member types
| タイプ
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> |
[編集] ノート
デストラクタは(その通常予測できない)スタックの解放時に例外をスローした場合、C + +プログラムが終了するため、すべての実用的なデストラクタは、それらがnoexceptと宣言されていない場合であっても非投げている。 C + +の標準ライブラリで見つかったすべてのデストラクタが非投げて.
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.
[編集] 例
#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'; }
Output:
std::string is destructible? true Foo is nothrow destructible? true Bar is trivally destructible? true
[編集] も参照してください
| (C++11) (C++11) (C++11) |
タイプかどうかをチェックするには、特定の引数のコンストラクタを持っています 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. (クラステンプレート) |
| (C++11) |
タイプかどうかをチェックするには、仮想デストラクタを持っています 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. (クラステンプレート) |