shared_ptr::operator*

 

Gets the designated value.

Syntax

Ty& operator*() const;

Remarks

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

Example

 

// 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

Requirements

Header: <memory>

Namespace: std

See Also

shared_ptr Class
shared_ptr::get