所以我正在尝试使用std::any_of()
函数,但是 C++ Builder 6 说有一个错误:
[C++ 错误] Unit1.cpp(93): E2316 'any_of' 不是 'std' 的成员
但我#include <algorithm>
在我的 Unit1.h
#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
.
抱歉英语不好。