Enum as generic type parameter

Hi All

I have the below class the purpose of which is to provide type safe access to a heterogeneous array of events from a finite type set that is known at compile time.

Currently I use a macro to build the an enum over this typeset and then am trying to inject that enum into a Iterator as a type parameter … the approach take do date seeems to require the enum name (string) be passed in as a construction parameter

I’d like to do T.createByName or extract the name form the type parameter somehow ?

thanks for any guidance

Sean

class ARSEnumIter<T> {
  private var evts:Array<ARSEvent>;
  private var idx:Int;
  private var enum_name:String;

  public function new(evts:Array<ARSEvent>, enum_name:String) {
    this.enum_name = enum_name;
    this.evts = evts;
    this.idx = 0;
  }

  public function hasNext() {
    return this.idx < this.evts.length;
  }

  public function next():T {
    var ars_evt = this.evts[this.idx++];
    return Type.resolveEnum(this.enum_name).createByName(ars_evt._name, [ars_evt]);
  }
}

solved this with a @:genericBuild macro … thanks Joshua G for reminding me that enums are in a sense basic types