std::mutex::unlock

void unlock(); (since C++11) Unlocks the mutex. The mutex must be locked by the current thread of execution, otherwise, the behavior is undefined. This operation synchronizes-with (as defined in std::memory_order) any subsequent lock operation that obtains ownership of the same mutex. Parameters (none). Return value (none). Exceptions (none). Notes unlock() is usually not called directly: std::unique_lock and std::lock_guard are used to manage exclusive locking. Example

std::mutex::try_lock

bool try_lock(); (since C++11) Tries to lock the mutex. Returns immediately. On successful lock acquisition returns true, otherwise returns false. This function is allowed to fail spuriously and return false even if the mutex is not currently locked by any other thread. If try_lock is called by a thread that already owns the mutex, the behavior is undefined. Prior unlock() operation on the same mutex synchronizes-with (as defined in std::memory_order) this operation if it returns true.

std::mutex::native_handle

native_handle_type native_handle(); (since C++11) (optional) Returns the underlying implementation-defined native handle object. Parameters (none). Return value Implementation-defined native handle object. Exceptions Implementation-defined. Example

std::mutex::mutex

constexpr mutex(); (1) (since C++11) mutex( const mutex& ) = delete; (2) (since C++11) 1) Constructs the mutex. The mutex is in unlocked state after the constructor completes. 2) Copy constructor is deleted. Parameters (none). Exceptions noexcept specification: noexcept Notes Because the default constructor is constexpr, static mutexes are initialized as part of static non-local initialization, before any dynamic non-local initialization begins. This makes it safe

std::mutex::lock

void lock(); (since C++11) Locks the mutex. If another thread has already locked the mutex, a call to lock will block execution until the lock is acquired. If lock is called by a thread that already owns the mutex, the behavior is undefined: the program may deadlock, or, if the implementation can detect the deadlock, a resource_deadlock_would_occur error condition may be thrown. Prior unlock() operation on the same mutex synchronizes-with (as defined in std::memory_order) this operation

std::mutex

Defined in header <mutex> class mutex; (since C++11) The mutex class is a synchronization primitive that can be used to protect shared data from being simultaneously accessed by multiple threads. mutex offers exclusive, non-recursive ownership semantics: A calling thread owns a mutex from the time that it successfully calls either lock or try_lock until it calls unlock. When a thread owns a mutex, all other threads will block (for calls to lock) or receive a false return

std::multiset::value_comp

std::multiset::value_compare value_comp() const; Returns the function object that compares the values. It is the same as key_comp. Parameters (none). Return value The value comparison function object. Complexity Constant. See also key_comp returns the function that compares keys (public member function)

std::multiset::upper_bound

iterator upper_bound( const Key& key ); (1) const_iterator upper_bound( const Key& key ) const; (1) template< class K > iterator upper_bound( const K& x ); (2) (since C++14) template< class K > const_iterator upper_bound( const K& x ) const; (2) (since C++14) 1) Returns an iterator pointing to the first element that is greater than key. 2) Returns an iterator pointing to the first element that compares greater to the value x. This overlo

std::multiset::swap

void swap( multiset& other ); Exchanges the contents of the container with those of other. Does not invoke any move, copy, or swap operations on individual elements. All iterators and references remain valid. The past-the-end iterator is invalidated. The Pred objects must be Swappable, and they are exchanged using unqualified call to non-member swap. If std::allocator_traits<allocator_type>::propagate_on_container_swap::value is true, then the allocators are exchanged using a

std::multiset::size

size_type size() const; Returns the number of elements in the container, i.e. std::distance(begin(), end()). Parameters (none). Return value The number of elements in the container. Exceptions (none) (until C++11) noexcept specification: noexcept (since C++11) Complexity Constant. Example The following code uses size to display the number of elements in a std::multiset: #include <set> #include <iostream> int main() { std::multiset<int> nums {