On Monday 12 July 2010 00:27:11 Rory McGuire wrote: > Do you know about the scope storage class, or about scope classes? > > { > scope tmp = new A(); > > // use tmp; > > tmp destructor is called. > } > > scope classes are similar: > http://www.digitalmars.com/d/2.0/class.html
Except that as I understand it, scope as a storage class is being deprecated. So, while it will work now, it won't later. Otherwise, given the restrictions on default constructors with structs, I'd use scope that way to solve the problem. If nothing else though, I would think that this situation would be a good case against deprecating scope as a storage class. - Jonathan M Davis