1
      2
      3
      4
      5
      6
      7
      8
      9
     10
     11
     12
     13
     14
     15
     16
     17
     18
     19
     20
     21
     22
     23
     24
     25
     26
     27
     28
     29
     30
     31
     32
     33
     34
     35
     36
     37
     38
     39
     40
     41
     42
     43
#include "Table.hpp"
#include <iostream>

template<unsigned int I>
struct ComputeSquare
{
    static constexpr unsigned int value = I * I;
};

template<unsigned int I>
struct Fibo
{
    static constexpr unsigned int value = Fibo<I-1>::value + Fibo<I-2>::value;
};

template<>
struct Fibo<0>
{
    static constexpr unsigned int value = 1;
};

template<>
struct Fibo<1>
{
    static constexpr unsigned int value = 1;
};


constexpr unsigned int N = 10;
using Squares = Table<N, ComputeSquare>;
using Fibos = Table<N, Fibo>;


int
main()
{
    for (unsigned int i = 0; i < N; ++i) {
        std::cout << Squares::val[i] << std::endl;
    }
    for (unsigned int i = 0; i < N; ++i) {
        std::cout << Fibos::val[i] << std::endl;
    }
}