Angelscript addon Template Containers
1.0
STL container powerr for Angelscript
|
Before you can register a template specialization for a container, you must first register the content class itself.
You can only register template specializations for these containers:
map and unordered_map are not available because they take 2 template parameters and that would require partial template specialization which angelscript probably doesnt support.
Some of the containers might require your class to have these operators implemented:
Hash is not an operator, but a functor by name of aatc_functor_hash
The tempspec registration functions work like this:
You can register a tempspec even if your class doesnt have all the required operators. The container's functions that require the missing operators will simply not be registered to the script and your c++ compiler probably wont cry about it (because the troublesome functions are hidden by template magics). If you try to register a tempspec for a container that totally requires an operator (for example set requires operator less) it probably wont work at all.
Registering a template specialization of the class "myVec3" for the containers vector and list:
Because myVec3 does not have an operator<
vector<myVec3>::sort and list<myVec3>::sort will not be available, but you can still register a tempspec of it.
Registering a hash function for the class "myVec3", so that we can use it in unordered_set: