I have this class:
template <typename T, uint64_t N>
struct Probe {
static const uint64_t Counter = N;
typedef T Type;
};
I use like:
typedef Probe <int, 0> FirstIntProbe;
typedef Probe <int, 1> SecondIntProbe;
typedef Probe <float, 2> FloatProbe;
Is it possible to create a time \ macro compilation method that allows me to instantiate this class without specifying a second parameter, for example:
typedef Probe <int, Something?> FirstIntProbe;
typedef Probe <int, Something?> SecondIntProbe;
typedef Probe <float, Something?> FloatProbe;
I suppose this is not possible, but again I saw people doing something in C ++. I would not think that this is possible earlier.
Update:
- There is no need to increase by one, it is simply important that each probe has its own number.
- No need to have a unique number in different .cpp files \ translation units.
source
share