Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
D 0.34 KB | None | 0 0
  1. import std.c.stdio: printf;
  2.  
  3. template Binary(int depth, int a, alias B) {
  4.     static if (depth == 0) {
  5.         enum Binary = 1;
  6.     } else {
  7.         enum Binary = 1 + B!(depth - 1, 0, B) + B!(depth - 1, 1, B);
  8.     }
  9. }
  10.  
  11. void main() {
  12.     enum int N = 550;
  13.     enum int instantiations = Binary!(N, 0, Binary);
  14.     printf("%d\n", instantiations);
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement