Boost logo

Boost :

Subject: [boost] [Utility] intuitive scoping with BOOST_WITH
From: Marcel Ebmer (marcel_at_[hidden])
Date: 2015-08-06 20:09:47

Hi Everyone,

What if you could do

std::mutex the_mutex; using Lock = std::unique_lock<std::mutex>; void
f() { with(Lock{the_mutex}) { do_something();
do_other_thing(); } }


struct Pushed_matrix {
    Pushed_matrix() { glPushMatrix(); }
    ~Pushed_matrix() { glPopMatrix(); }

void f() {

At C++Now (2015), I presented this idea of mine and a macro
implementation (BOOST_WITH) in a lightning talk. Since reception was
good and more serious than the talk itself, I continued to work on it. I
would appreciate informal review and opinions:


Boost list run by bdawes at, gregod at, cpdaniel at, john at