zoukankan      html  css  js  c++  java
  • 16.允许重复的multimap

     1 #include <iostream>
     2 #include <map>
     3 #include <cstring>
     4 using namespace std;
     5 
     6 
     7 void main()
     8 {
     9     multimap<char *, int>mymap;
    10     mymap.insert(pair<char *, int>("司令1", 10));
    11     mymap.insert(pair<char *, int>("司令1", 11));
    12     mymap.insert(pair<char *, int>("司令3", 12));
    13     mymap.insert(pair<char *, int>("司令4", 13));
    14     mymap.insert(pair<char *, int>("司令5", 14));
    15 
    16     
    17 
    18     for (auto i : mymap)
    19     {
    20         cout << i.first << " " << i.second << endl;
    21     }
    22 
    23     auto it = mymap.equal_range("司令1");
    24     for (auto ib = it.first, ie = it.second; ib != ie; ib++)
    25     {
    26         cout << (*ib).first << "  " << (*ib).second << endl;
    27     }
    28     cin.get();
    29 }
  • 相关阅读:
    组合模式
    迭代器模式
    命令模式
    装饰者模式
    观察者模式
    策略模式
    适配器模式和外观模式
    Servlet
    Java 递归
    Java 反射
  • 原文地址:https://www.cnblogs.com/xiaochi/p/8628731.html
Copyright © 2011-2022 走看看