PDA

View Full Version : Qt 5 class parameter as std::function<>



ad5xj
2nd December 2015, 22:35
I am having difficulty with some borrowed code that is supposedly working. It contains a class defined like:



#include <functional>
using namespace std;

class ClassName
{
public:
ClassName(parm1 parm, const std::function<double(quint16,quint16)>& func, parm3 param);
};


The Qt 5.5 compiler complains:

function does not name a type

and of course, a few errors that cascade after due to this one.

I am not sure what the compiler error is all about. The library <functional> is where the function<> is contained and is included.

What am I missing here?

Scope
3rd December 2015, 07:54
I can compile without any problem this



class ClassName
{
public:
ClassName(int x, const std::function<double(quint16,quint16)>& func, int y, int z);
};


and inside .pro file I have line



CONFIG += C++14