gpt4 book ai didi

c++ - E2316 'any_of' 不是 'std' 的成员

转载 作者:行者123 更新时间:2023-11-28 00:16:32 28 4
gpt4 key购买 nike

所以我正在尝试使用 std::any_of()函数,但是 C++ Builder 6 说有一个错误:

[C++ Error] Unit1.cpp(93): E2316 'any_of' is not a member 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 .

抱歉英语不好。

最佳答案

C++ Builder 32 位不兼容 C++11。对于所有 c++11 功能,您需要使用 64 位版本。

std::set_unionstd::set_intersectionstd::set_difference 不是 c++11 特性,这就是为什么他们工作。

关于c++ - E2316 'any_of' 不是 'std' 的成员,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29950858/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com