#include <iostream>     // cout
#include <algorithm> // equal_range, sort
#include <vector> // vector
using namespace std;
bool mygreater (int i,int j) { return (i>j); } int main () {
int myints[] = {,,,,,,,};
vector<int> v(myints,myints+); // 10 20 30 30 20 10 10 20
pair<vector<int>::iterator,vector<int>::iterator> bounds; bounds=equal_range (v.begin(), v.end(), );
cout << "bounds at positions " << (bounds.first - v.begin());
cout << " and " << (bounds.second - v.begin()) << '\n'; // using default comparison:
sort (v.begin(), v.end()); // 10 10 10 20 20 20 30 30
bounds=equal_range (v.begin(), v.end(), ); // ^ ^ cout << "bounds at positions " << (bounds.first - v.begin());
cout << " and " << (bounds.second - v.begin()) << '\n'; // using "mygreater" as comp:
sort (v.begin(), v.end(), mygreater); // 30 30 20 20 20 10 10 10
bounds=equal_range (v.begin(), v.end(), , mygreater); // ^ ^ cout << "bounds at positions " << (bounds.first - v.begin());
cout << " and " << (bounds.second - v.begin()) << '\n'; return ;
}

最新文章

  1. 用&quot;hosting.json&quot;配置ASP.NET Core站点的Hosting环境
  2. Oracle SQL explain/execution Plan
  3. 安装R语言扩展包diveRsity-1
  4. ListFragment创建及其生命周期
  5. openssl_final学习总结
  6. percona-toolkit工具包的使用教程
  7. iOS语音播放之切换听筒和扬声器的方法解决方案
  8. Hibernate项目里配置环境时,jar包配置不当会对测试结果产生影响。
  9. html 标签释义
  10. 【Python中if __name__ == &#39;__main__&#39;: 的解析】
  11. python中的线程技术
  12. 单例模式实例&amp;多线程应用
  13. Eclipse markers窗口使用
  14. Tomcat实战-调优方案
  15. HDFS的客户端操作
  16. javascript数据结构与算法--二叉树(插入节点、生成二叉树)
  17. ubuntu16.04下安装opencv-nonfree
  18. 网络基础 04_IP编址
  19. PHPStrom 里修改Emmet对php的自动扩展
  20. Hdu2433 Travel

热门文章

  1. Message Flood(map)
  2. 连接数据库工具类DBUtil
  3. Linux系统——PXE高效能批量网络装机
  4. centos6更改密码
  5. Root :: AOAPC I: Beginning Algorithm Contests (Rujia Liu) Volume 5. Dynamic Programming
  6. jq 自定义标注小组件 $.widget
  7. python3.4学习笔记(五) IDLE显示行号问题,插件安装和其他开发工具介绍
  8. web前端----html表单操作
  9. NSDictionary打印编码改中文的方法
  10. MySQL Crash Course #18# Chapter 26. Managing Transaction Processing