Hi Guru
I am updating my post, so my codes can be better understood; This codes is meant to demonstrate the problem i am facing, although it doesn't do anything much.
I run VC++ 2019 with latest compiler build Visual Studio 2019 version 16.10.3; (could this be the buggg!!??)
I get a build error at this line:
Code:
Diagnostic(int* pointer, std::function<QVariant(int*)> fn = [](int* pointer){return QVariant::fromValue(std::remove_pointer_t<T>(pointer)) ;})
'T': undeclared identifier
Does your compiler gave you such build error, i want to know., because i thought i used to be able to build this codes successfully; or have i made a mistake somewhere? How do i correct it?
Basically my codes:
Code:
template<typename T>
class Diagnostic : QObject
{
public:
Diagnostic(int* pointer, std::function<QVariant(int*)> fn = [](int* pointer){return QVariant::fromValue(std::remove_pointer_t<T>(pointer)) ;})
{
}
};
int main(int argc, char *argv[])
{
int * test = new int;
*test=5;
Diagnostic<int*> dg(test);
delete test;
}