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.


The type of the element.

typedef Ty element_type;

The type is a synonym for the template parameter Ty.


// std_tr1__memory__weak_ptr_element_type.cpp 
// compile with: /EHsc 
#include <memory> 
#include <iostream> 
int main() 
    std::shared_ptr<int> sp0(new int(5)); 
    std::weak_ptr<int> wp0(sp0); 
    std::weak_ptr<int>::element_type val = *wp0.lock(); 
    std::cout << "*wp0.lock() == " << val << std::endl; 
    return (0); 
*wp0.lock() == 5

Header: <memory>

Namespace: std

© 2014 Microsoft