I'm working on passing lambda functions R1 and R2 to my template function F. But, I'm not sure if I'm doing this correctly.
The Function F is supposed to use all the parameters from the main function and perform the related calculations (Newton's method of root approx.).
I'm new to working with template functions. So, any help would be much appreciated.
//main.cpp
#include <iostream>
#include "Funct.h"
using namespace std;
int main()
{
auto f1 = [](long double x) { return (x * x) - 2; };
auto f2 = [](long double x) { return (2 * x);
auto RV1 = F<long double>(1.0L,1.0E-20L,f1(1.0L),f2(1.0L));
return 0;
}
//Funct.h
#include <iostream>
#include<cmath>
template<typename T> T F(long double guess, long double tolerance,T ((*f)(const T x)), T((*df)(const T x)));
template<typename T> T F(long double guess, long double tolerance,T ((*f)(const T x)), T((*df)(const T x)))
{
}