I have a static class that generates unique ID's. The id's are
hardcoded as ints.
I would like to make this extensible and allow for other integer
numeric values to be(byte, ulong, etc...).
I can simply make the static class generic without issues.
The problem is the return type of the Get ID function, while
generic, requires hardcoding the saved ID in a class.
e.g.,
class myclass {
int ID;
}
while I want ID's type to be that of the uniqueID's type.
e.g.,
class myclass {
auto ID = uniqueID!T.Get();
}
would make ID a type T (T is defined by the user and known at
compile time). In another class one might use a different type.
Is anything like this possible? It is purely for convenience as
I'm trying to avoid having to change the type at two or more
places.