Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Bool explicit conversion

operator unspecified-bool-type() const
bool operator!() const

Locks provide an explicit bool conversion operator when the compiler provides them.

explicit operator bool() const;

The library provides un implicit conversion to an undefined type that can be used as a conditional expression.

#if defined(BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS)
    operator unspecified-bool-type() const;
    bool operator!() const;
#else
    explicit operator bool() const;
#endif

The user should use the lock.owns_lock() when an explicit conversion is required.

Returns:

If owns_lock() would return true, a value that evaluates to true in boolean contexts, otherwise a value that evaluates to false in boolean contexts.

Throws:

Nothing.

Returns:

! owns_lock().

Throws:

Nothing.


PrevUpHomeNext