Documentation Home >> Headers >> <mutex> Header >> std::unique_lock >> std::unique_lock::operator bool Member Function

Check whether or not *this owns a lock on a mutex.

explicit operator bool() const;

Returns:

this->owns_lock().

Throws:

Nothing.

Note:

This is an explicit conversion operator, so is only implicitly called in contexts where the result is used as a boolean, and not where the result would be treated as an integer value 0 or 1. This behaviour is emulated on compilers that do not support C++11 explicit operators.

Header

#include <mutex>

See Also