libstdc++
std::weak_ptr< _Tp > Class Template Reference

#include <shared_ptr.h>

Inherits std::__weak_ptr< _Tp, _Lp >.

Public Types

using element_type = typename remove_extent< _Tp >::type
 

Public Member Functions

template<typename _Yp , typename = _Constructible<const shared_ptr<_Yp>&>>
 weak_ptr (const shared_ptr< _Yp > &__r) noexcept
 
 weak_ptr (const weak_ptr &) noexcept=default
 
template<typename _Yp , typename = _Constructible<const weak_ptr<_Yp>&>>
 weak_ptr (const weak_ptr< _Yp > &__r) noexcept
 
 weak_ptr (weak_ptr &&) noexcept=default
 
template<typename _Yp , typename = _Constructible<weak_ptr<_Yp>>>
 weak_ptr (weak_ptr< _Yp > &&__r) noexcept
 
bool expired () const noexcept
 
shared_ptr< _Tp > lock () const noexcept
 
template<typename _Yp >
_Assignable< const shared_ptr< _Yp > & > operator= (const shared_ptr< _Yp > &__r) noexcept
 
weak_ptroperator= (const weak_ptr &__r) noexcept=default
 
template<typename _Yp >
_Assignable< const weak_ptr< _Yp > & > operator= (const weak_ptr< _Yp > &__r) noexcept
 
weak_ptroperator= (weak_ptr &&__r) noexcept=default
 
template<typename _Yp >
_Assignable< weak_ptr< _Yp > > operator= (weak_ptr< _Yp > &&__r) noexcept
 
template<typename _Tp1 >
bool owner_before (const __shared_ptr< _Tp1, _Lp > &__rhs) const noexcept
 
template<typename _Tp1 >
bool owner_before (const __weak_ptr< _Tp1, _Lp > &__rhs) const noexcept
 
void reset () noexcept
 
void swap (__weak_ptr &__s) noexcept
 
long use_count () const noexcept
 

Detailed Description

template<typename _Tp>
class std::weak_ptr< _Tp >

A smart pointer with weak semantics.

With forwarding constructors and assignment operators.

Definition at line 531 of file bits/shared_ptr.h.

Member Typedef Documentation

◆ element_type

template<typename _Tp , _Lock_policy _Lp>
using std::__weak_ptr< _Tp, _Lp >::element_type = typename remove_extent<_Tp>::type
inherited

Definition at line 1588 of file shared_ptr_base.h.

Constructor & Destructor Documentation

◆ weak_ptr() [1/3]

template<typename _Tp >
template<typename _Yp , typename = _Constructible<const shared_ptr<_Yp>&>>
std::weak_ptr< _Tp >::weak_ptr ( const shared_ptr< _Yp > &  __r)
inlinenoexcept

Definition at line 548 of file bits/shared_ptr.h.

◆ weak_ptr() [2/3]

template<typename _Tp >
template<typename _Yp , typename = _Constructible<const weak_ptr<_Yp>&>>
std::weak_ptr< _Tp >::weak_ptr ( const weak_ptr< _Yp > &  __r)
inlinenoexcept

Definition at line 554 of file bits/shared_ptr.h.

◆ weak_ptr() [3/3]

template<typename _Tp >
template<typename _Yp , typename = _Constructible<weak_ptr<_Yp>>>
std::weak_ptr< _Tp >::weak_ptr ( weak_ptr< _Yp > &&  __r)
inlinenoexcept

Definition at line 560 of file bits/shared_ptr.h.

Member Function Documentation

◆ expired()

template<typename _Tp , _Lock_policy _Lp>
bool std::__weak_ptr< _Tp, _Lp >::expired ( ) const
inlinenoexceptinherited

Definition at line 1680 of file shared_ptr_base.h.

◆ lock()

template<typename _Tp >
shared_ptr< _Tp > std::weak_ptr< _Tp >::lock ( ) const
inlinenoexcept

Definition at line 594 of file bits/shared_ptr.h.

◆ operator=() [1/3]

template<typename _Tp >
template<typename _Yp >
_Assignable< const shared_ptr< _Yp > & > std::weak_ptr< _Tp >::operator= ( const shared_ptr< _Yp > &  __r)
inlinenoexcept

Definition at line 576 of file bits/shared_ptr.h.

◆ operator=() [2/3]

template<typename _Tp >
template<typename _Yp >
_Assignable< const weak_ptr< _Yp > & > std::weak_ptr< _Tp >::operator= ( const weak_ptr< _Yp > &  __r)
inlinenoexcept

Definition at line 568 of file bits/shared_ptr.h.

◆ operator=() [3/3]

template<typename _Tp >
template<typename _Yp >
_Assignable< weak_ptr< _Yp > > std::weak_ptr< _Tp >::operator= ( weak_ptr< _Yp > &&  __r)
inlinenoexcept

Definition at line 587 of file bits/shared_ptr.h.

◆ owner_before() [1/2]

template<typename _Tp , _Lock_policy _Lp>
template<typename _Tp1 >
bool std::__weak_ptr< _Tp, _Lp >::owner_before ( const __shared_ptr< _Tp1, _Lp > &  __rhs) const
inlinenoexceptinherited

Definition at line 1685 of file shared_ptr_base.h.

◆ owner_before() [2/2]

template<typename _Tp , _Lock_policy _Lp>
template<typename _Tp1 >
bool std::__weak_ptr< _Tp, _Lp >::owner_before ( const __weak_ptr< _Tp1, _Lp > &  __rhs) const
inlinenoexceptinherited

Definition at line 1690 of file shared_ptr_base.h.

◆ reset()

template<typename _Tp , _Lock_policy _Lp>
void std::__weak_ptr< _Tp, _Lp >::reset ( )
inlinenoexceptinherited

Definition at line 1694 of file shared_ptr_base.h.

◆ swap()

template<typename _Tp , _Lock_policy _Lp>
void std::__weak_ptr< _Tp, _Lp >::swap ( __weak_ptr< _Tp, _Lp > &  __s)
inlinenoexceptinherited

Definition at line 1698 of file shared_ptr_base.h.

◆ use_count()

template<typename _Tp , _Lock_policy _Lp>
long std::__weak_ptr< _Tp, _Lp >::use_count ( ) const
inlinenoexceptinherited

Definition at line 1676 of file shared_ptr_base.h.


The documentation for this class was generated from the following file: