View source code
							
							
						
								Display the source code in object.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 object.capacity
(Property) Gets the current capacity of a slice. The capacity is the size that the slice can grow to before the underlying array must be reallocated or extended.
						
				size_t capacity(T)
				(
				
				  T[] arr
				
				) pure nothrow @property @trusted;
						
					
				If an append must reallocate a slice with no possibility of extension, then
0 is returned. This happens when the slice references a static array, or
if another slice references elements past the end of the current slice.
Note
The capacity of a slice may be impacted by operations on other slices.
Example
//Static array slice: no capacity
int[4] sarray = [1, 2, 3, 4];
int[]  slice  = sarray[];
writeln(sarrayAuthors
Walter Bright, Sean Kelly
License
					Copyright © 1999-2022 by the D Language Foundation | Page generated by ddox.