I hope this helps you . I'm working in C# and would like to store a type on my class, but I want that type to be of either a certain class, or subclass of it. , Are you asking about something like this:
hop of those help? I was wondering if it is possible to restrict a template type to be a variable type of a specific size? Assuming I want to accept 4-bytes variable and rejects all the others, if running this code on some compiler where sizeof(int) == 4 and sizeof(bool) == 1: , You could use a static assertion:
template <class T> FourOnly
static_assert(sizeof(T)==4, "T is not 4 bytes");
When using the 'Class' datatype, how can I specify the type so I only accept subclass of a specific class?