简体   繁体   English

使用结构绑定时,qtcreator无法自动完成吗?

[英]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.

相关问题 为什么在Python 3.4的循环中使用socket.connect()会停止工作? - Why does socket.connect() stop working when used within a loop in Python 3.4? 为什么这个 size_t i = size 变量在 for 循环中使用时给出“垃圾”值? - Why does this size_t i = size variable giving "garbage" value when used in for loop? pytorch 数据集 object 在 for 循环中使用时如何知道它是否已经结束? - How does a pytorch dataset object know whether it has hit the end when used in a for loop? 如果在'for'循环中使用'for'函数,它是如何工作的? - How does the 'for' function work if it is used in a 'for' loop? 当在Javascript中使用许多for循环时,输出未定义 - When many for loops are used in Javascript, output is undefined 与函数一起使用时数组的问题 - Problem with Arrays when being used with a function 需要说明:在JavaScript中使用... in和for(;;)时的输出不同 - Explaination needed: Different outputs when used for…in and for(;;) in JavaScript 使用数组时无法在javascript中打印行 - cant print rows in javascript when array is used 与FOR循环一起使用时,FORFILES不再递归 - FORFILES no longer recursive when used with FOR loop 如果在删除的for语句中使用StatementExpressionList,ForInit的值是什么时候? - When are the values of the ForInit if a StatementExpressionList is used in a for statement discared?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM