I have 2 header files
a1.h
namespace a
{
enum abc:uint8
{
abc1 = 1
abc2 = 2
};
}
and a2.h
namespace b
{
enum abc:uint8
{
abc1 = 1
abc2 = 2
abc3 = 3
};
}
I want to apply some operation dosomething(a::abc / b::abc) on the enum. The easiest solution would be to write two separate functions for different namespaces.
I am wondering if dosomething function can be templatized given
-
Enum values are same
-
Enum values are different
This would avoid code duplication and make the design extendable.
I have constraint that I cannot modify header files.
Aucun commentaire:
Enregistrer un commentaire