View source code
							
							
						
								Display the source code in core/memory.d from which this
								page was generated on github.
							
						
							Report a bug
							
						
								If you spot a problem with this page, click here to create a
								Bugzilla issue.
							
						
							
								Improve this page
							
							
					
								Quickly fork, edit online, and submit a pull request for this page.
								Requires a signed-in GitHub account. This works well for small changes.
								If you'd like to make larger changes you may want to consider using
								local clone.
							
						Function core.memory.moveToGC
Moves a value to a new GC allocation.
						
				T* moveToGC(T)
				(
				
				  auto ref T value
				
				);
						
					
				Parameters
| Name | Description | 
|---|---|
| value | Value to be moved. If the argument is an lvalue and a struct with a
            destructor or postblit, it will be reset to its value. | 
Returns
A pointer to the new GC-allocated value.
Example
struct S
{
    int x;
    this(this) @disable;
    ~this() @safe pure nothrow @nogc {}
}
S* p;
// rvalue
p = moveToGC(S(123));
writeln(pAuthors
Sean Kelly, Alex Rønne Petersen
License
					Copyright © 1999-2024 by the D Language Foundation | Page generated by ddox.