title: Implementing C++ equivalent of C# using statement
body: <p>I am looking for an elegant solution for implementing the equivalent of the C# using statement in C++. Ideally the resultant syntax should be simple to use and read.</p>
  
  <p>C# Using statement details are here - 
  <a href="http://msdn.microsoft.com/en-us/library/yh598w02(v=vs.80).aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/yh598w02(v=vs.80).aspx</a></p>
  
  <p>I am not sure whether the solution would be to use function pointers with destructors on classes, some form of clever template programming or even meta template programming. Basically I do not know where to start with this... </p>