Advertisement
Guest User

Untitled

a guest
Oct 16th, 2016
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
D 0.54 KB | None | 0 0
  1. template TokenIdType(alias staticTokens, alias dynamicTokens,
  2.     alias possibleDefaultTokens)
  3. {
  4.     immutable tokenCount = staticTokens.length + dynamicTokens.length
  5.         + possibleDefaultTokens.length + 1;
  6.     static if (tokenCount <= ubyte.max)
  7.         alias TokenIdType = ubyte;
  8.     else static if (tokenCount <= ushort.max)
  9.         alias TokenIdType = ushort;
  10.     else static if (tokenCount <= uint.max)
  11.         alias TokenIdType = uint;
  12.     else
  13.         static assert (false, "The number of tokens must be less than uint.max");
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement