During preparation and presentation of a Lightning Talk about my BOOST_WITH Macro at the C++Now 2015 Conference, three important issues showed need for being addressed:

  1. The if statement solution with an unused (and useless) condition variable leads to compiler warnings. This is a noteworthy fail, since compiler warnings were part of my motivation for developing the macro in the first place!
  2. You could write code like
    BOOST_WITH(whatever) {} // if(true) {}
    else foo();

    – which is clearly not desirable.

  3. An alternative implementation, using a single-pass for loop suffers a similar problem – you could break and continue in a BOOST_WITH block.

The Macro clearly had to be revisited…

Continue reading