Thursday, February 12, 2015

Dictionary – Minor Refactoring

Before continuing with the reduction of the virtual table functions for the codes with operands, some minor refactoring and clean up was performed on the dictionary classes.  This included the removal of unnecessary comments (stating the obvious or had become inaccurate).  The inline functions defined in the class definitions were moved outside of the class cleaning up the class definition.

The add function was reimplemented so that the key map of the dictionary is not searched twice for new entries.  Previously it searched for the key (using the find function) and then if it wasn't found, added it added it to the key map (using the emplace function, which did a second search).  The emplace function can cover both with one call.  It returns a standard pair of the iterator for the key and a flag whether the key was added or not.  The value of the key is not affected if the key is already present.

[branch table commit a0243036df]