View source code
							
							
						
								Display the source code in std/algorithm/mutation.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 std.algorithm.mutation.moveEmplace
Similar to move but assumes target is uninitialized. This
 is more efficient because source can be blitted over target
 without destroying or initializing it first.
						
				void moveEmplace(T)
				(
				
				  ref T source,
				
				  ref T target
				
				) pure @system;
						
					
				Parameters
| Name | Description | 
|---|---|
| source | value to be moved into target | 
| target | uninitialized value to be filled by source | 
Example
static struct Foo
{
pure nothrow @nogc:
    this(int* ptr) { _ptr = ptr; }
    ~this() { if (_ptr) ++*_ptr; }
    int* _ptr;
}
int val;
Foo foo1 = void; // uninitialized
auto foo2 = Foo(&val); // initialized
assert(foo2Authors
License
					Copyright © 1999-2024 by the D Language Foundation | Page generated by ddox.