Consider the following code class:

```
class A {
   public:
      int number;
      vector<int> powers;

      A () {
         number = 5;
         powers.resize(100);
      }

      long long getPower(int x) {
        return powers[x];
      }

      void precompute() {
         powers[0] = 1;
         for (int i = 1; i < 100; i++) {
            powers[i] = powers[i - 1] * number;
         }
       }
};

```

In the class `A`, we have a vector called `powers` and an integer `number` with the property that `powers[k]` stores the quantity `numbers^k` after the `precompute()` function has been called. If we want to answer several queries of the form "Compute `numbers^x` for some integer `0 <= x < 100`", it makes sense to precompute all of these powers and return them when we need them as a constant-time operation (note: this is not a problem that I am actually facing. I have made this problem up for the sake of an example. Please ignore the fact that `numbers^x` would exceed the maximum value of a `long long`).

However, there is one issue: the user must have called the `precompute()` function before calling the `getPower()` function. 

This leads me to the following question: Is there some nice way to enforce the constraint that some function `A` can only be called after function `B` is called? Of course, one could just use a `flag` variable, but I am wondering if there is a more elegant way to do this so that it becomes a compile-time error.

Another option would be to always call the `precompute()` function in the constructor, but this may not be an optimal solution if we weren't always going to call `precompute()` in the first place. If calling `precompute()` is a sufficiently expensive (computationally), then this method would not be preferable.

I would prefer getting a compile-time error over a runtime error, but I am open to all approaches. Does anyone have any ideas?