Template std.typecons.scoped
Allocates a class object right inside the current scope,
therefore avoiding the overhead of new. This facility is unsafe;
it is the responsibility of the user to not escape a reference to the
object outside the scope.
						
				template scoped(T)
				;
						
					
				The class destructor will be called when the result of scoped() is
itself destroyed.
Scoped class instances can be embedded in a parent class or struct,
just like a child struct instance. Scoped member variables must have
type typeof(scoped!Class(args)), and be initialized with a call to
scoped. See below for an example.
Contained Functions
| Name | Description | 
|---|---|
| scoped | Returns the scoped object. | 
Note
It's illegal to move a class instance even if you are sure there are no pointers to it. As such, it is illegal to move a scoped object.
Example
class A
{
    int x;
    this()     {x = 0;}
    this(int i){x = i;}
    ~this()    {}
}
// Standard usage, constructing A on the stack
auto a1 = scoped!A();
a1Authors
Andrei Alexandrescu, Bartosz Milewski, Don Clugston, Shin Fujishiro, Kenji Hara