[英]E2316 'any_of' is not a member of 'std'
因此,我嘗試使用std::any_of()
函數,但是C ++ Builder 6表示存在錯誤:
[C ++錯誤] Unit1.cpp(93):E2316'any_of'不是'std'的成員
但是我的Unit1.h中有#include <algorithm>
#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <ExtCtrls.hpp>
#include <set>
#include <algorithm> // std::set_union, std::sort, etc
#include <vector> // std::vector
#include <math.h>
//--------------------------------------------------------------------------
我的Unit1.cpp:
void __fastcall TForm1::Button7Click(TObject *Sender)
{
int el = StrToInt(LabeledEdit1->Text);
if ( std::any_of(A.begin(), A.end(), (*MyIteratorA==el)) ){
ShowMessage("true");
}else{
ShowMessage("false");
}
}
這很奇怪,因為我在同一程序中使用了諸如std::set_union()
, std::set_intersection()
, std::set_difference()
類的函數,並且一切正常,直到std::any_of
。
對不起,英語不好。
C ++ Builder 32位不兼容C ++ 11。 對於所有c ++ 11功能,您需要使用64位版本。
std::set_union
, std::set_intersection
和std::set_difference
不是c ++ 11功能,這就是它們起作用的原因。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.