You can use std::find from <algorithm>:

std::find(vector.begin(), vector.end(), item) != vector.end()

This returns a bool (true if present, false otherwise). With your example:

#include <algorithm>

if ( std::find(vector.begin(), vector.end(), item) != vector.end() )
do_this();
else
do_that();

最新文章

  1. JAVA继承时构造函数的问题
  2. 【转】jQuery获取Select option 选择的Text和Value
  3. iOS开发之多线程技术——NSOperation篇
  4. 分布式拒绝服务攻击 DDoS
  5. JDK的安装与配置
  6. android之显示数据库信息
  7. javaee添加验证码
  8. Jsoncpp 数组的使用
  9. Entity Framework CodeFirst------数据迁移(二)
  10. json数组传递到后台controller
  11. C++第二天学习
  12. 面向切面编程(Aop)
  13. Caused by: org.apache.hadoop.ipc.RemoteException(org.apache.hadoop.security.AccessControlException):
  14. JDK、JRE、JVM详解
  15. golang包管理工具glide安装
  16. Linux基础命令-Nginx-正则表达式( grep sed awk )-Shell Script--etc
  17. P2789 直线交点数
  18. Java基础知识(JAVA基本数据类型包装类)
  19. ubuntu部署nginx
  20. threading.Condition()

热门文章

  1. AngularJS插件使用---angular-cookies.js
  2. CentOS 6.5 nginx+tomcat+ssl配置
  3. I - 动物狂想曲 HDU - 6252(差分约束)
  4. 直播回顾 | IOT、AI、云计算等融合技术推进制造业产业转型(二)
  5. EEPROM存储芯片24C02
  6. 《Three.js 入门指南》3.1.1 - 基本几何形状 -多面体
  7. PTA数据结构与算法题目集(中文) 7-36 社交网络图中结点的“重要性”计算 (30 分)
  8. Nordic nRF52820超低功耗蓝牙5.2 SoC芯片-低端无线连接方案首选
  9. ssh配置文件最佳实践(伪)
  10. 《深入理解 Java 虚拟机》读书笔记:晚期(运行期)优化