gpt4 book ai didi

c++ - 将 std::list::remove_if 与 MyClass 函数一起使用

转载 作者:太空宇宙 更新时间:2023-11-04 14:33:33 25 4
gpt4 key购买 nike

<分区>

我有 std::list<MyClass> *info1我想用 (*info1).remove_if带有 MyClass 的 bool 函数。如我所见,每个人都为 remove_if 创建外部函数或结构。不能与 bool MyClass::Condition() 一起使用吗?功能?

像这样:

 class MyClass
{
private:
int value;
public:
bool Condition()
{
return ( value > 7500);
}
};

然后

   (*info1).remove_if(Condition())`

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