Do you know the functionality of these MATLAB functions, or you are looking for an already written
c++ code that does these function. interpn and ndgrid are quite complicated functions in MATLAB (in terms of the various optional parameters they support, see full description in
here) in a way that even implementing them in MATLAB results in a relatively huge code. So it's good to see how MATLAB people have implemented them, well normally they don't release all the built in functions codes even if it is written in MATLAB but you might find how people have done it in octave
here (the octave code I believe doesn't support as many options as does the MATLAB one).
Anyway, I can just tell you that if you want to write a
c++ code that can do everything that these two functions do, then the job is quite big. First you need to support various interpolation methods like spline and cubic interpolation. Worse than that you need to support for arbitrary number of input dimensions, and thirdly your code should work under pressure, i.e. when dimension increases and more complicated method is requested by user and the length of query input is big. Therefore I think you need first decide what is the max dimension that you want to support.
Now let's give you a very simple example, assume that your sample points are x = [0 1 2 3 4 5 6] and your sample values are v=[v0 v1 v2 v3 v4 v5 v6] and you want to find the interpolated value at x0 = 3.3 using cubic interpolation. clearly this is 1-D interpolation. x0 lies between x=3 and x=4, in cubic interpolation you need to find a third order polynomial that passes through two sample points before x0 and two sample points after x0, v(x) = a0 + a1*x + a2*x^2 + a3*x^3, you need to find a0, a1, a2, and a3. You have four known points, so it should be easy for you to find a0-a3. then the interpolated value will be v(3.3). As you can see v(x) can be used for any input in the range of [3,4].You of course need special treatments if x0 is less than 1 or bigger than 5 (see what MATLAB) does.