I have two c++ programs that need to have a map type -> int
that is known at compile time and equal between the two programs. Furthermore, I'd like to automatically make sure at compile time that the map is one-to-one. How would you solve that? (c++0x-extensions are allowed). The first part is easy: Share a
template < typename T > struct map;
template <> struct map <...> { enum { val = ...; }; };
between the programs. (The second part means that I don't want to accidently define the same val
for two different types somewhere in my programs.)