std::weak_ptr
に対する推定ガイド
提供: cppreference.com
ヘッダ <memory> で定義
|
||
template<class T> weak_ptr(std::shared_ptr<T>) -> weak_ptr<T>; |
(C++17以上) | |
暗黙の推定ガイドでカバーされないエッジケースに対処するため、 std::weak_ptr に対して1つの推定ガイドが提供されます。
[編集] 例
Run this code
#include <memory> int main() { auto p = std::make_shared<int>(42); std::weak_ptr w{p}; // explicit deduction guide is used in this case }