the template argument functions as class members

You need to pass values not types as your template arguments. Here is a reduced example using your code with all the unnecessary details removed and a couple methods added to demonstrate the usage of the template parameters.

long double sigmoid(long double x);
long double sigmoidDerivative(long double x);

using FuncT = long double(*)(long double);

template<FuncT Forward, FuncT Backward>
class Layer
{
public:
    long double applyForward(long double x) { return Forward(x); }
    long double applyBackward(long double x) { return Backward(x); }
};

class Sigmoid : public Layer<sigmoid, sigmoidDerivative> {};

Demo: https://godbolt.org/z/99h54a

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top