std::weak_ptr::swap

void swap( weak_ptr& r ); (since C++11) Exchanges the contents of *this and r. Parameters r - smart pointer to exchange the contents with Return value (none). Exceptions noexcept specification: noexcept

std::weak_ptr::reset

void reset(); (since C++11) Releases the reference to the managed object. After the call *this manages no object. Parameters (none). Return value (none). Exceptions noexcept specification: noexcept

std::weak_ptr::owner_before

template< class Y > bool owner_before( const weak_ptr<Y>& other) const; template< class Y > bool owner_before( const std::shared_ptr<Y>& other) const; Checks whether this weak_ptr precedes other in implementation defined owner-based (as opposed to value-based) order. The order is such that two smart pointers compare equivalent only if they are both empty or if they both own the same object, even if the values of the pointers obtained by get() are d

std::weak_ptr::lock

std::shared_ptr<T> lock() const; (since C++11) Creates a new std::shared_ptr that shares ownership of the managed object. If there is no managed object, i.e. *this is empty, then the returned shared_ptr also is empty. Effectively returns expired() ? shared_ptr<T>() : shared_ptr<T>(*this), executed atomically. Parameters (none). Return value A shared_ptr which shares ownership of the owned object. Exceptions noexcept specification: noexcept Notes Both this

std::weak_ptr::expired

bool expired() const; (since C++11) Checks whether the managed object has already been deleted. Equivalent to use_count() == 0. Parameters (none). Return value true if the managed object has already been deleted, false otherwise. Exceptions noexcept specification: noexcept Example Demonstrates how expired is used to check validity of the pointer. #include <iostream> #include <memory> std::weak_ptr<int> gw; void f() { if (!gw.expired()) {

std::weak_ptr

Defined in header <memory> template< class T > class weak_ptr; (since C++11) std::weak_ptr is a smart pointer that holds a non-owning ("weak") reference to an object that is managed by std::shared_ptr. It must be converted to std::shared_ptr in order to access the referenced object. std::weak_ptr models temporary ownership: when an object needs to be accessed only if it exists, and it may be deleted at any time by someone else, std::weak_ptr is used to track the objec

std::wctype

Defined in header <cwctype> std::wctype_t wctype( const char* str ); Constructs a value of type std::wctype_t that describes a LC_CTYPE category of wide character classification. It may be one of the standard classification categories, or a locale-specific category, such as "jkanji". Parameters str - C string holding the name of the desired category The following values of str are supported in all C locales: value of str effect "alnum" identifies the categ

std::wctrans

Defined in header <cwctype> std::wctrans_t wctrans( const char* str ); Constructs a value of type std::wctrans_t that describes a LC_CTYPE category of wide character mapping. It may be one of the standard mappings, or a locale-specific mapping, such as "tojhira" or "tojkana". Parameters str - C string holding the name of the desired mapping. The following values of str are supported in all C locales: Value of str Effect "toupper" identifies the mapping used b

std::wctomb

Defined in header <cstdlib> int wctomb( char *s, wchar_t wc ); Converts a wide character wc to multibyte encoding and stores it (including any shift sequences) in the char array whose first element is pointed to by s. No more than MB_CUR_MAX characters are stored. If wc is the null character, the null byte is written to s, preceded by any shift sequences necessary to restore the initial shift state. If s is a null pointer, resets the global conversion state and determines w

std::wctob

Defined in header <cwchar> int wctob( std::wint_t c ); Narrows a wide character c if its multibyte character equivalent in the initial shift state is a single byte. This is typically possible for the characters from the ASCII character set, since most multibyte encodings (such as UTF-8) use single bytes to encode those characters. Parameters c - wide character to narrow Return value EOF if c does not represent a multibyte character with length 1 in initial shi