View source code
							
							
						
								Display the source code in std/array.d from which thispage was generated on github.
							
						
							Report a bug
							
						
								If you spot a problem with this page, click here to create aBugzilla 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 usinglocal clone.
							
						std.array.array  - multiple declarations
				Function array
Allocates an array and initializes it with copies of the elements
 of range r.
						
				ForeachType!Range[] array(Range)(
				
  Range r
				
				)
				
				if (isIterable!Range && !isAutodecodableString!Range && !isInfinite!Range);
				
				
				ForeachType!(typeof((*Range).init))[] array(Range)(
				
  Range r
				
				)
				
				if (is(Range == U*, U) && isIterable!U && !isAutodecodableString!Range && !isInfinite!Range);
						
					
				Narrow strings are handled as follows: - If autodecoding is turned on (default), then they are handled as a separate overload. - If autodecoding is turned off, then this is equivalent to duplicating the array.
Parameters
| Name | Description | 
|---|---|
| r | range (or aggregate with opApplyfunction) whose elements are copied into the allocated array | 
Returns
allocated and initialized array
Example
auto a = array([1, 2, 3, 4, 5][]);
writeln(a); // [1, 2, 3, 4, 5]
Function array
Convert a narrow autodecoding string to an array type that fully supports
random access.  This is handled as a special case and always returns an array
of dchar
						
				CopyTypeQualifiers!(ElementType!String,dchar)[] array(String)(
				
  scope String str
				
				)
				
				if (isAutodecodableString!String);
						
					
				NOTE
This function is never used when autodecoding is turned off.
Parameters
| Name | Description | 
|---|---|
| str | isNarrowStringto be converted to an array ofdchar | 
Returns
a dchar[], const(dchar)[], or immutable(dchar)[] depending on the constness of
    the input.
Example
import stdAuthors
License
					Copyright © 1999-2025 by the D Language Foundation | Page generated by ddox.