繁体   English   中英

使用结构绑定时,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);
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM