This is fundamentally impossible. You can only have 2 out of 3: constexpr-ness, ability to declare those in multiple places, and the IDs being sequental and always unique. If you abandon the latter (since you say you want the first two), you can just hash the strings.
↧