std::binary_search

Defined in header <algorithm> template< class ForwardIt, class T > bool binary_search( ForwardIt first, ForwardIt last, const T& value ); (1) template< class ForwardIt, class T, class Compare > bool binary_search( ForwardIt first, ForwardIt last, const T& value, Compare comp ); (2) Checks if an element equivalent to value appears within the range [first, last). For std::binary_search to succeed, the range [first, last) must be at least partially or

std::scoped_allocator_adaptor::destroy

Defined in header <scoped_allocator> template< class T > void destroy( T* p ); (since C++11) Uses the outer allocator to call the destructor of the object pointed to by p, by calling. std::allocator_traits<OUTERMOST>::destroy(OUTERMOST(*this), p). where OUTERMOST is the type that would be returned by calling this->outer_allocator(), and then calling the outer_allocator() member function recursively on the result of this call until reaching the type that has n

std::wcstombs

Defined in header <cstdlib> std::size_t wcstombs( char* dst, const wchar_t* src, std::size_t len); Converts a sequence of wide characters from the array whose first element is pointed to by src to its narrow multibyte representation that begins in the initial shift state. Converted characters are stored in the successive elements of the char array pointed to by dst. No more than len bytes are written to the destination array. Each character is converted as if by a call to s

std::swap(std::thread)

void swap( thread &lhs, thread &rhs ); (since C++11) Overloads the std::swap algorithm for std::thread. Exchanges the state of lhs with that of rhs. Effectively calls lhs.swap(rhs). Parameters lhs, rhs - threads whose states to swap Return value (none). Exceptions noexcept specification: noexcept Example #include <iostream> #include <thread> #include <chrono> void foo() { std::this_thread::sleep_for(std::chrono::seconds(1)); } vo

std::begin

Defined in header <iterator> template< class C > auto begin( C& c ) -> decltype(c.begin()); (1) (since C++11) template< class C > auto begin( const C& c ) -> decltype(c.begin()); (1) (since C++11) (2) template< class T, std::size_t N > T* begin( T (&array)[N] ); (since C++11) (until C++14) template< class T, std::size_t N > constexpr T* begin( T (&array)[N] ); (since C++14) template< class C > constex

std::basic_stringbuf::seekpos

protected: virtual pos_type seekpos(pos_type sp, std::ios_base::openmode which = std::ios_base::in | std::ios_base::out ); Repositions std::basic_streambuf::gptr and/or std::basic_streambuf::pptr, if possible, to the position indicated by sp. Effectively executes seekoff(off_type(sp), std::ios_base::beg, which). Parameters sp - stream position, such as one obtained by seekoff() or seekpos() which - defines whether the input sequences, the output se

std::exit

Defined in header <cstdlib> void exit( int exit_code ); (until C++11) [[noreturn]] void exit( int exit_code ); (since C++11) Causes normal program termination to occur. Several cleanup steps are performed: 1) destructors of objects with static storage duration are called in reverse order of completion of their constructors or the completion of their dynamic initialization, and the functions passed to std::atexit are called in reverse order they are regi

std::call_once

Defined in header <mutex> template< class Callable, class... Args > void call_once( std::once_flag& flag, Callable&& f, Args&&... args ); (since C++11) Executes the Callable object f exactly once, even if called from several threads. Each group of call_once invocations that receives the same std::once_flag object will meet the following requirements: Exactly one execution of exactly one of the functions (passed as f to the invocations in the group

The rule of three/five/zero

Rule of three If a class requires a user-defined destructor, a user-defined copy constructor, or a user-defined copy assignment operator, it almost certainly requires all three. Because C++ copies and copy-assigns objects of user-defined types in various situations (passing/returning by value, manipulating a container, etc), these special member functions will be called, if accessible, and if they are not user-defined, they are implicitly-defined by the compiler. The implicitly-defined speci

std::swap(std::weak_ptr)

template< class T > void swap( weak_ptr<T>& lhs, weak_ptr<T>& rhs ); (since C++11) Specializes the std::swap algorithm for std::weak_ptr. Swaps the pointers of lhs and rhs. Calls lhs.swap(rhs). Parameters lhs, rhs - smart pointers whose contents to swap Return value (none). Exceptions noexcept specification: noexcept Complexity Constant. See also swap swaps the values of two objects (function template) swap swaps the contents (