다음을 통해 공유


shared_ptr::get

소유한 리소스의 주소를 가져옵니다.

Ty *get() const;

설명

The member function returns the address of the owned resource. If the object does not own a resource it returns 0.

예제

 

// std_tr1__memory__shared_ptr_get.cpp 
// compile with: /EHsc 
#include <memory> 
#include <iostream> 
 
int main() 
    { 
    std::shared_ptr<int> sp0; 
    std::shared_ptr<int> sp1(new int(5)); 
 
    std::cout << "sp0.get() == 0 == " << std::boolalpha 
        << (sp0.get() == 0) << std::endl; 
    std::cout << "*sp1.get() == " << *sp1.get() << std::endl; 
 
    return (0); 
    } 
 
  

요구 사항

헤더 <memory>

네임스페이스: std

참고 항목

참조

shared_ptr 클래스

shared_ptr::operator*

shared_ptr::operator->