I have an external C++ function. The header file looks like:

```
#ifndef tacppnew_hpp
#define tacppnew_hpp
#include <boost/math/distributions/normal.hpp>
#include <stan/math.hpp>
#include <vector>
#include <iostream>
#include <limits>
#include <sstream>
template <typename T_a__, typename T_b__,typename T_theta__>
typename boost::math::tools::promote_args <T_a__, T_b__, T_theta__>::type
test3( const double& a, const double& b, const double beta, const double mu0, const double mu1, const double gamma, const double delta, const double sigma, const double M0, std::ostream& msgs) {
using stan::math::var;
auto const f2= [&](const double x, const double xc, const std::vector<var> theta, std::vector<double> x_r, std::vector<int> x_i, std::ostream& msgs) {
return ( 0.5 * erfc(-(M0-(theta[1]+theta[2]*exp(- theta[3]* pow((7.0+log(x)),theta[4]))))/(theta[5]*sqrt(2.0))) );
};
std::vector<double> theta = {beta, mu0, mu1, gamma, delta, sigma};
var Q = stan::math::integrate_1d(f2, a, b, theta,{},{}, msgs);
return Q;
}
#endif /* tacppnew_hpp */
```

I want to use this external C++ function in the model block. For this, I declared it in the function block. I canâ€™t understand how to use it in the model block. The current model block looks like:

```
model{
//priors
K~ exponential(1);
cp~exponential(1);
p~normal(1.12,0.16) T[1,];
//likelihood
real[N] partcA;
for (i==1){
partcA[i] = partC( t[1], t[2], beta, mu0, mu1, gamma,
delta, sigma, M0)
}
for(i in 2: (N-1)){
partcA[i] += partC( t[i]-t[1:(i-1)], t[i+1]-t[1:(i-1)], beta, mu0, mu1, gamma,
delta, sigma, M0)
}
for (i==N){
partcA[i] += partC( t[i]-t[1:(i-1)], T-t[1:(i-1)], beta, mu0, mu1, gamma,
delta, sigma, M0)
}
real final = partA ( N, K, cp, p, t, rt, M0, T) - partB- sum(partcA)
}
```

Am I doing it correctly? Please help.