method reallocate

Documentation for method reallocate assembled from the following types:

role Buf

From Buf

(Buf) method reallocate

method reallocate($elems)

Change the number of elements of the Buf. The Buf will be made larger if the specified value is larger than the current number of elements. The value of newly created elements is undetermined and should thus not be relied upon. It returns the altered Buf.

my Buf $b .= new(^10);
$b.reallocate(5);
say $b.perl;  # OUTPUT: «Buf.new(0,1,2,3,4)␤»