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:
- The
ifstatement 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! - You could write code like
BOOST_WITH(whatever) {} // if(true) {} else foo();– which is clearly not desirable.
- An alternative implementation, using a single-pass
forloop suffers a similar problem – you couldbreakandcontinuein aBOOST_WITHblock.
The Macro clearly had to be revisited…
