Export (0) Print
Expand All

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

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.

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

 

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

Header: <memory>

Namespace: std

Show:
© 2014 Microsoft