Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I guess you meant std::lock_guard.

Anyway, the first example creates a temporary object which doesn't lock anything since it will be destroyed right away because it's an rvalue (not sure why would anyone do that for locking, unless not knowingly). The second example creates a proper guard which lives until the end of the scope.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: