package flash
Available on flash
The Vector class is very similar to Array but is only supported by the Flash Player 10+
staticinlineconvert<T, U>(v:Vector<T>):Vector<U>staticinlineofArray<T>(v:Array<T>):Vector<T>staticinlinetypeReference<T>():Class<Vector<T>>Get a run-time value referencing the Vector class with concrete type parameters.
Normally in Haxe, for most of the types, type parameters are eliminated at run-time, so there is no way to check if a value is of a type with specific type parameters.
However, on the Flash target, the flash.Vector<T> values carry type parameter information at run-time all the type-checks (such as Std.isOfType and Std.downcast) on them must be done using a Class<T> value that also carries the type parameters. However, Haxe syntax does not allow creating such values and this function exists to mitigate this limitation.
It should be used as such:
var specificVectorType:Class<Vector<Int>> = Vector.typeReference();
trace(Std.isOfType(vec, specificVectorType)); or using the type-check syntax:
trace(Std.isOfType(vec, (Vector.typeReference() : Class<Vector<Int>>))); It's also helpful when working with native Flash libraries, that receive Class instances:
new Signal((Vector.typeReference() : Class<Vector<Int>>));
new(?length:UInt, ?fixed:Bool)fixed:Boollength:IntremoveAt:(index:Int) ‑> Tconcat(?a:Vector<T>):Vector<T>indexOf(x:T, ?from:Int):IntinlineinsertAt(index:Int, element:T):Voidjoin(sep:String):StringlastIndexOf(x:T, ?from:Int):Intpop():Null<T>push(x:T):Intreverse():Voidshift():Null<T>slice(?pos:Int, ?end:Int):Vector<T>sort(f:(T, T) ‑> Int):Voidsplice(pos:Int, len:Int):Vector<T>toString():Stringunshift(x:T):Void
© 2005–2020 Haxe Foundation
Licensed under a MIT license.
https://api.haxe.org/flash/Vector.html