Is there anyways to have a define increment every time you use it?
For example
int a = ADEFINE; int b = ADEFINE;
a is 1 and b is 2.
If you don't need compile-time-constants, you could do something like this to enumerate classes:
int counter() {
static int i = 0;
return i++;
}
template
int id() {
static int i = counter();
return i;
};
class A {};
class B {};
int main()
{
std::cout << id() << std::endl;
std::cout << id() << std::endl;
}