Coming from C++ to AS3 : what are fundamental AS3 data structures classes?
We are porting out game from C++ to web; the game make extensive use of 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 :
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 :(
Can anyone point to some industry standard algorithms library for AS3 programs (like boost in C++)? I can not believe people can write non-trivial software without balanced binary search trees (std::set std::map)!
The choices of data structures are significantly more limited in as3. You have:
Array
orVector.<*>
which stores a list of values and can be added to after constructionDictionary
(hash_map) which stores key/value pairs
maps and sets aren't really supported as there's no way to override object equality. 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
Maybe this library will fit your needs.
精彩评论