Поделиться через


operator<< (<memory>)

shared_ptr inserter.

template<class Elem, class Tr, class Ty>
    std::basic_ostream<Elem, Tr>& operator<<(std::basic_ostream<Elem, Tr>& out,
    shared_ptr<Ty>& sp);

Parameters

  • Elem
    The type of the stream element.

  • Tr
    The type the stream element traits.

  • Ty
    The type controlled by the shared pointer.

  • out
    The output stream.

  • sp
    The shared pointer.

Remarks

The template function returns out << sp.get().

Example

 

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

Requirements

Header: <memory>

Namespace: std

See Also

Reference

shared_ptr Class

Other Resources

<memory> Members