簡體   English   中英

錯誤“函數count_if()無法解析”-C ++

[英]Error “function count_if() could not be resolved” - C++

我正在使用Eclipse進行C ++測試,但遇到了與count_if()函數相關的錯誤。 這是我的代碼:

  #include <iostream>
  #include  <vector>

   using namespace std;

   int main(){

   vector<int> v{3,4,5,6,7,8,9,10,100,12,2};
   auto isodd=[](int x){return x % 2;};

   std::count_if(begin(v),end(v),isodd(3));

   return 0;
 }

編譯該程序時,Eclipse給出以下錯誤:“無法解析function count_if()”。

感謝您的任何提示。

我犯了一個非常愚蠢的錯誤。

#include < algorithm>
我已經解決了我的問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM