aboutsummaryrefslogtreecommitdiff
path: root/power_table.h
blob: 548020edfa6485f1e53da78cc1dac9117c96c403 (plain)
1
2
3
4
5
6
7
8
9
10
#include <vector>

template <typename Mod> struct PowerTable : public std::vector<Mod> {
  explicit PowerTable(int n, Mod a) : std::vector<Mod>(n) {
    (*this)[0] = Mod{1};
    for (int i = 1; i < n; ++i) {
      (*this)[i] = (*this)[i - 1] * a;
    }
  }
};