简体   繁体   English

从C ++到AS3:什么是基本的AS3数据结构类?

[英]Coming from C++ to AS3 : what are fundamental AS3 data structures classes?

We are porting out game from C++ to web; 我们正在将游戏从C ++迁移到网络; the game make extensive use of STL. 游戏广泛使用STL。

Can you provide short comparison chart (and if possible, a bit of code samples for basic operations like insertion/deletion/searching and (where applicable) equal_range/binary_search) for the classes what are equivalents to the following STL containers : 您是否可以提供简短的比较图表(如果可能的话,为基本操作提供一些代码示例,例如插入/删除/搜索和(如果适用)equal_range / binary_search)以下类与以下STL容器等效的类:

std::vector
std::set
std::map
std::list
stdext::hash_map

?

Thanks a lot for your time! 非常感谢你的时间!

UPD: wow, it seems we do not have everything we needhere :( UPD:哇,似乎我们没有我们需要的一切:(

Can anyone point to some industry standard algorithms library for AS3 programs (like boost in C++)? 任何人都可以指出一些AS3程序的行业标准算法库(比如C ++中的boost)吗? I can not believe people can write non-trivial software without balanced binary search trees (std::set std::map)! 如果没有平衡的二叉搜索树(std :: set std :: map),我无法相信人们可以编写非平凡的软件!

The choices of data structures are significantly more limited in as3. 数据结构的选择在as3中受到更多限制。 You have: 你有:

  • Array or Vector.<*> which stores a list of values and can be added to after construction ArrayVector.<*>存储值列表,可以在构造之后添加
  • Dictionary (hash_map) which stores key/value pairs 存储键/值对的Dictionary (hash_map)

maps and sets aren't really supported as there's no way to override object equality. 因为没有办法覆盖对象相等性,所以不支持map和sets。 As for binary search, most search operations take a predicate function for you to override equality for that search. 对于二进制搜索,大多数搜索操作都会使用谓词函数来覆盖该搜索的相等性。

Edit: As far as common algorithm and utility libraries, I'd take a look at as3commons 编辑:至于常见的算法和实用程序库,我会看看as3commons

也许这个可以满足您的需求。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM