On 5/19/2013 10:41 AM, deadalnix wrote:
I have bunch of code that goes like :

auto oldVar = var;
scope(exit) var = oldVar;

This is begging for a RAII solution where I pass var as template parameter but
would require default constructor. This is an actual problem I have right now as
all save/restore are harder and harder to keep in sync for no reason and
generate a lot of boilerplate.

This is a problem I have right now that default constructor would solve, and
this isn't the first time I hit that need.

oldVar isn't being default constructed in your example, nor can I see why you'd need a default constructor in order to use RAII for save/restore.

Reply via email to