浏览代码

[cpp] Use template to cast Dynamic key to int in IntMap. Closes #3355

Hugh 11 年之前
父节点
当前提交
fc26718d2d
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. 3 1
      std/cpp/_std/haxe/ds/IntMap.hx

+ 3 - 1
std/cpp/_std/haxe/ds/IntMap.hx

@@ -34,7 +34,9 @@ package haxe.ds;
   inline void set(int key, float value) { __int_hash_set_float(h,key,value); }
   inline void set(int key, double value) { __int_hash_set_float(h,key,value); }
   inline void set(int key, ::String value) { __int_hash_set_string(h,key,value); }
-  inline Void set(Dynamic key, ::Dynamic value) { __int_hash_set(h,key,value); return null(); }
+
+  template<typename VALUE>
+  inline void set(Dynamic &key, const VALUE &value) { set( (int)key, value ); }
 ")
 @:coreApi class IntMap<T> implements haxe.Constraints.IMap<Int,T> {