make_unique Creator 中的参数太少
make_unique Too Few Arguments in Creator
#include <QCoreApplication>
#include <iostream>
#include <memory>
using namespace std;
class A{
public:
A(){cout << "ctorA " << endl;}
~A(){cout << "dtorA " << endl;}
};
class X{
A arr[10];
};
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
{ unique_ptr<X> upX = make_unique<X>(); }
return a.exec();
}
Qt Creator 下划线 std::make_unique
,当我用鼠标悬停在它上面时,它告诉我有 "Too few arguments"。编译并运行良好。据我所知,没有错误或警告。我做错了什么或者这是 Creator 中的错误还是什么?最新的编译器 gcc7.3.something 和 Qt10.something。今天刚拿到。
Qt Creator 似乎在 c++14 语法突出显示方面存在问题,正如 Qt 论坛中的许多主题所指出的那样(例如 here and here)。
建议的解决方案是启用 Clang 代码模型插件
这似乎解决了这个问题,尽管我注意到在使用单引号作为数字分隔符时自动代码格式化 (Ctrl-I) 存在一些问题。 #ifdef
也有 this 类问题(已解决 closing/reopening 文件)。我在 Ubuntu.
上使用 Qt Creator 4.4.1
#include <QCoreApplication>
#include <iostream>
#include <memory>
using namespace std;
class A{
public:
A(){cout << "ctorA " << endl;}
~A(){cout << "dtorA " << endl;}
};
class X{
A arr[10];
};
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
{ unique_ptr<X> upX = make_unique<X>(); }
return a.exec();
}
Qt Creator 下划线 std::make_unique
,当我用鼠标悬停在它上面时,它告诉我有 "Too few arguments"。编译并运行良好。据我所知,没有错误或警告。我做错了什么或者这是 Creator 中的错误还是什么?最新的编译器 gcc7.3.something 和 Qt10.something。今天刚拿到。
Qt Creator 似乎在 c++14 语法突出显示方面存在问题,正如 Qt 论坛中的许多主题所指出的那样(例如 here and here)。
建议的解决方案是启用 Clang 代码模型插件
这似乎解决了这个问题,尽管我注意到在使用单引号作为数字分隔符时自动代码格式化 (Ctrl-I) 存在一些问题。 #ifdef
也有 this 类问题(已解决 closing/reopening 文件)。我在 Ubuntu.