I just had a go at using templates working off the tutorials here. i get their point and what they do, but there are some things I don't understand yet. For example whats the difference between template <class Something> and template <typename Something>?
Also, in my code I would like to be able to check if a number is greater or equal than the number of bits in my storage type. What would be the best way to do it with this? This seems to work, but I think I read somewhere that sizeof() should only really be used for mallocing:
Oh and why do I have to put <IntType> between the object name and the function name as in here:Code:
if(bit >= sizeof(IntType)*8) return false;
There seems to be no point to it. Anyway, I'll shut up now ;)Code:
template <class IntType> bool Flag<IntType>::FlipBit(Uint8 bit)