• c++,  Code

    Strong Typing PODs

    Identifiying object by a numerical integer is an almost trivial task. In DISPLACE, a very complex simulator I am involved with, there are many of different categories of objects that model different categoris of agents in the simulator, like vessels, marine locations, ships, ports, and so on. Each object has an Id, and it was very natural, at the start of the project, to implement it using an int. Problems started when we decided, for optimization purpose, to shrink the memory footprint, to use smaller int instead. Indeed, there could be at most 65535 nodes, and at most 256 node types, and each was modeled with an int. The mess started when we…