shared_ptr::operator*

获取一个指定的值。

Ty& operator*() const;

备注

间接寻址运算符返回 *get()。 因此,内存的指针不能是空的。

示例

 

// 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); 
    } 
 
  

要求

页眉: <内存>

命名空间: std

请参见

参考

shared_ptr 类

shared_ptr::get