簡體   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