The current TokenMap class uses the std::map implementation. This map is alright but if you try to iterate over it, e.g.:
TokenMap vars;
calculator::calculate("a = map('c': 1, 'b': 2, 'a': 3)", vars);
std::cout << vars["a"] << std::endl; // { 'a': 3, 'b': 2, 'c': 1 } (alphanumerical order)
It shows the keys in alphanumerical order instead of the insertion order. This is undesired since Javascript or Ruby users would expect it to remember the insertion order.
This feature should be set either hardcoded or as an optional feature (but i think no one will really complain if its hardcoded, so it might be for the best)
The only drawback of the hardcoded approach is that it might be sightly less space efficient, I think.
The current TokenMap class uses the std::map implementation. This map is alright but if you try to iterate over it, e.g.:
It shows the keys in alphanumerical order instead of the insertion order. This is undesired since Javascript or Ruby users would expect it to remember the insertion order.
This feature should be set either hardcoded or as an optional feature (but i think no one will really complain if its hardcoded, so it might be for the best)
The only drawback of the hardcoded approach is that it might be sightly less space efficient, I think.