View source code
							
							
						
								Display the source code in std/array.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.
							
						Struct std.array.RefAppender
A version of Appender that can update an array in-place.
 It forwards all calls to an underlying appender implementation.
 Any calls made to the appender also update the pointer to the
 original array passed in.
						
				struct RefAppender(A)
				
				  
				
				if (isDynamicArray!A);
						
					
				Constructors
| Name | Description | 
|---|---|
| this(arr) | Constructs a RefAppenderwith a given array reference.  This does not copy the
 data.  If the array has a larger capacity as determined byarr, it
 will be used by the appender. | 
Properties
| Name | Type | Description | 
|---|---|---|
| capacity[get] | size_t | Returns the capacity of the array (the maximum number of elements the
 managed array can accommodate before triggering a reallocation).  If any
 appending will reallocate, capacityreturns0. | 
| opSlice[get] | inout(ElementEncodingType!A)[] | 
Methods
| Name | Description | 
|---|---|
| opDispatch(args) | Wraps remaining Appendermethods such asput. | 
| opOpAssign(rhs) | Appends rhsto the managed array. | 
Tip
Use the arrayPtr overload of appender for construction with type-inference.
Parameters
| Name | Description | 
|---|---|
| A | The array type to simulate | 
Example
int[] a = [1, 2];
auto app2 = appender(&a);
writeln(app2[]); // [1, 2]
writeln(a); // [1, 2]
app2 ~= 3;
app2 ~= [4, 5, 6];
writeln(app2[]); // [1, 2, 3, 4, 5, 6]
writeln(a); // [1, 2, 3, 4, 5, 6]
app2Authors
License
					Copyright © 1999-2024 by the D Language Foundation | Page generated by ddox.