make_unique创作者的论点太少了

时间:2018-02-09 02:40:54

标签: qt

#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,当我用鼠标悬停在它上面时,它告诉我“参数太少”。编译并运行良好。据我所知,没有任何错误或警告。我做错了什么或者这是Creator中的错误还是什么?最新编译器gcc7.3.something和Qt10.something。刚刚拿到它。

1 个答案:

答案 0 :(得分:1)

Qt Creator似乎存在c ++ 14语法高亮问题,正如Qt论坛中的许多主题所指出的那样(例如herehere)。

建议的解决方案是启用似乎可以解决问题的Clang Code Model plugin ,尽管我在使用单引号作为数字分隔符时发现了自动代码格式化(Ctrl-I)的一些问题。此外#ifdef还有this类问题(已解决关闭/重新打开文件)。我在Ubuntu上使用Qt Creator 4.4.1。