SimDictionary improvement

Includes #892 with tweaks. In comparison to that PR, I inverted the use of the `#define` so that it defaults to the old behaviour, and adding a define enables the new. This plays nicer with existing projects and the current CI setup (which needs to be fixed).
cast to ```size_t``` ?