다음을 통해 공유


weak_ptr::reset

버전 리소스를 소유합니다.

void reset();

설명

멤버 함수를 가리키는 리소스 해제 *this 및 변환 *this 빈 weak_ptr 개체입니다.

예제

 

// std_tr1__memory__weak_ptr_reset.cpp 
// compile with: /EHsc 
#include <memory> 
#include <iostream> 
 
int main() 
    { 
    std::shared_ptr<int> sp(new int(5)); 
    std::weak_ptr<int> wp(sp); 
    std::cout << "*wp.lock() == " << *wp.lock() << std::endl; 
    std::cout << "wp.expired() == " << std::boolalpha 
        << wp.expired() << std::endl; 
 
    wp.reset(); 
    std::cout << "wp.expired() == " << std::boolalpha 
        << wp.expired() << std::endl; 
 
    return (0); 
    } 
 
  

요구 사항

헤더: <memory>

네임 스페이스: std

참고 항목

참조

weak_ptr Class

weak_ptr::operator=