0

I'm getting various related issues working with using a function of this templated class.

For the header I have:

template<typename T>
class Stats {
    public:
        Stats();
        std::vector<T> polyfit( const std::vector<T>&, const std::vector<T>&, int );
        std::vector<T> polyval( const std::vector<T>& oCoeff, const std::vector<T>& );
        QList<int> linearRegression(int, int, int);
        static QList<int> DFT(QList<int>,QList<int>);

};

And then for the function definition, I have:

template<typename T>
QList<int> Stats<T>::DFT(QList<int> samples,QList<int> freqs){
    ...
    ...
}

And then, this is where the issue occurs, in another class, I have this:

Stats<int> stats();
QList<int> DFTs = stats.DFT(chunks.at(i),freqs);

The issue occurs at the stats.DFT() line, and is currently

request for member 'DFT' in 'stats', which is of non-class type 'Stats<int>()'
     QList<int> DFTs = stats.DFT(chunks.at(i),freqs);
                             ^

Changing Stats<int> stats() to Stats<int> stats results in the following error:

undefined reference to `Stats<int>::Stats()'

The constructor definition is:

template<class T>
Stats<T>::Stats(){

}

The suggested answer does not use templates and the solution applied to this template class instantiation results in a new error.

JVE999
  • 3,327
  • 10
  • 54
  • 89

0 Answers0