Talespin_Kit
Talespin_Kit

Reputation: 21897

boost scoped_lock object in if statement evaluation

The following code compiles

scoped_lock<named_mutex> lock(some_mutex);
if (!lock) { // What does this means, which function is called
}

Since lock is an object what happens inthe if (!lock). Does any overloaded function gets called.

Upvotes: 1

Views: 64

Answers (1)

xosp7tom
xosp7tom

Reputation: 2183

operator unspecified_bool_type() const;, which returns owns(), will be called

http://live.boost.org/doc/libs/release/doc/html/boost/interprocess/scoped_lock.html

Upvotes: 2

Related Questions