Add member functions and member variables based on template argument

For each n > 0, we add a new member function taking that value as an argument that inherits from the next level down:

template<int n, typename Real=double>
class f
    : public f<n-1, Real>
{
public:
    f() { /* initialize dv */ }

    using f<n-1, Real>::prime;
    Real prime(Real x, integral_constant<int, n>) { 
        /* find appropriate index for x, and interpolate on dv */
    }

protected:
    std::vector<Real> dv;
};

Where the base version adds the operator():

template<typename Real=double>
class f<0, Real>
{
public:
    f() { /* initialize v */ }

    Real operator()(Real x) { /* find appropriate index for x, and interpolate */}
    Real prime(Real x) { return (*this)(x); }

protected:
    std::vector<Real> v;
};

This means that the first derivative calls prime(x, integral_constant<int, 1>{}), the second derivative calls prime(x, integral_constant<int, 2>{}), etc.