|
@@ -129,6 +129,21 @@ abstract Vector<T>(VectorData<T>) {
|
|
|
#end
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ Creates a new Array, copy the content from the Vector to it, and returns it.
|
|
|
+ **/
|
|
|
+ public #if flash inline #end function toArray():Array<T> {
|
|
|
+ var a = new Array();
|
|
|
+ var len = length;
|
|
|
+ #if (cpp || neko)
|
|
|
+ // prealloc good size
|
|
|
+ if( len > 0 ) a[len - 1] = get(0);
|
|
|
+ #end
|
|
|
+ for( i in 0...len )
|
|
|
+ a[i] = get(i);
|
|
|
+ return a;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
Extracts the data of `this` Vector.
|
|
|
|