Windows Dev Center

Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

shared_ptr::operator*

Gets the designated value.

Ty& operator*() const;

The indirection operator returns *get(). Hence, the stored pointer must not be null.

 

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

Header: <memory>

Namespace: std

Show:
© 2015 Microsoft