Solving problems with the One Definition Rule
Phil Karlton was right on point when he said the following:
Names are difficult for a few reasons – they have to be precise, simple, short, and expressive at the same time. That makes them meaningful and allows programmers to understand the concepts behind the raw implementation. C++ and many other languages impose one more requirement – many names have to be unique.
This is manifested in a few different ways. A programmer is required to follow the ODR. This says that in the scope of a single translation unit (a single .cpp
file), you are required to define it exactly once, even if you declare the same name (of a variable, function, class type, enumeration, concept, or template) multiple times.
This rule is extended to the scope of an entire program for all variables you effectively use in your code and non-inlined...