[英]qtcreator does not autocomplete when structure bindings is used?
I seem to have an issue with qtcreator not autocompleting my code, which is getting pretty annoying. 我似乎在qtcreator不能自动完成代码的问题上遇到了麻烦。
Currently is it not able to autocomplete when i try to use structure bindings in for loops like this.. 目前,当我尝试在这样的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 basically complains about everything about the code posted above.. qtcreator基本上抱怨上面发布的代码的所有问题。
But when I write it like this: 但是当我这样写的时候:
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 does not complain about this code, and seem to autocomplete it just fine.. So why is it causing so many problems with c++17 style? qtcreator不会抱怨此代码,并且似乎可以自动完成它。.为什么它会导致c ++ 17样式出现这么多问题?
Any fixes for this? 有什么解决办法吗?
A temporary solution for this seem to be something like this - which autocompletions does not complain about, and seem to suit my definition of (readability): 临时解决方案似乎是这样的-自动完成功能不会抱怨,并且似乎适合我对(可读性)的定义:
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.