std::bad_weak_ptr
提供: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 <memory>
|
||
| class bad_weak_ptr; |
(C + + 11以来) | |
std::bad_weak_ptrstd::shared_ptrは既に削除されたオブジェクトを参照するときに、引数としてstd::weak_ptrを取るstd::weak_ptrのコンストラクタが例外としてスローされるオブジェクトのタイプです.Original:
std::bad_weak_ptr is the type of the object thrown as exceptions by the constructors of std::shared_ptr that take std::weak_ptr as the argument, when the std::weak_ptr refers to an already deleted object.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.
目次 |
[編集] メンバ関数
bad_weak_ptrオブジェクトを作成しますOriginal: constructs the bad_weak_ptr objectThe text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (パブリックメンバ関数) | |
Inherited from std::exception
Member functions
| [仮想] |
例外オブジェクトを破棄します Original: destructs the exception object The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (仮想パブリックメンバ関数of std::exception)
|
| [仮想] |
説明文字列を返します Original: returns an explanatory string The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (仮想パブリックメンバ関数of std::exception)
|
[編集] 例
#include <memory> #include <iostream> int main() { std::shared_ptr<int> p1(new int(42)); std::weak_ptr<int> wp(p1); p1.reset(); try { std::shared_ptr<int> p2(wp); } catch(const std::bad_weak_ptr& e) { std::cout << e.what() << '\n'; } }
Output:
std::bad_weak_ptr
[編集] も参照してください
| (C++11) |
smart pointer with shared object ownership semantics (クラステンプレート) |
| (C++11) |
std::shared_ptrによって管理されているオブジェクトへの弱い参照 Original: weak reference to an object managed by std::shared_ptr The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (クラステンプレート) |
