使用结构绑定时 qtcreator 不会自动完成?

qtcreator does not autocomplete when structure bindings is used?

我似乎对 qtcreator 没有自动完成我的代码有疑问,这很烦人。

目前,当我尝试在这样的 for 循环中使用结构绑定时,它无法自动完成吗..

std::vector<pair<string,AudioFile<double>>> list_of_files;
// Some init of list_of_file


for (const auto& [name,file]: this->list_of_files) // red line under this.. does seem to like structure bindings?
{
    file.printSummary(); // qtcreator don't offer any autocomplete options?

}

qtcreator 基本上抱怨上面发布的代码的所有内容..

但是当我这样写的时候:

for (int i = 0 ; i <list_of_file.size() ; i++) // No red lines under this.. 
{
  list_of_files[i].second.printSummary() // Autocompletes without any problems.
}

qtcreator 没有抱怨这段代码,似乎自动完成它就好了。那么为什么它会导致 c++17 风格的这么多问题?

有任何修复吗?

这个问题的临时解决方案似乎是这样的——自动完成不会抱怨,而且似乎符合我对(可读性)的定义:

for ( const auto &elements : this->list_of_files)
{
   auto name = std::get<0>(elements);
   auto file = std::get<1>(elements);
}