std::find和std::find_if算法与std::bind和lambda组合使用方法

本文介绍了C++中如何结合使用std::find, std::find_if算法,以及std::bind和lambda表达式。详细探讨了这些工具的功能和它们在STL中的应用,特别强调了在查找操作中的效率,时间复杂度为O(n)。" 112280835,10536267,使用 Neo4j 构建知识图谱:从入门到实践,"['图形数据库', '知识图谱', 'Neo4j', 'Python接口', '数据导入']
摘要由CSDN通过智能技术生成
  • std::find
  • std::find_if
  • std::bind
  • std::distance
  • lambda

详见:http://www.cplusplus.com/reference/algorithm/find/

#include <algorithm>
#include <functional>
#include <iostream>
#include <string>
#include <vector>

class Item {
   
 private:
  int mId;
  std::string mName;

 public:
  Item(int id, std::string name) : mId(id), mName(name) {
   }

  std::string getName() const {
    return mName; }

  int getId() const {
    return mId; }

  bool operator==(const Item& obj2) const {
   
    return (this->getName().compare(obj2.getName()) == 0) &&
           (this->getId() == obj2.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值