C++ multimap

2021. 3. 26. 15:20·C++/Library

multimap

  • <map> 라이브러리

예제

  • key가 중복이 될 수 있는 map이다.

    #include <iostream>
    #include <map>
    
    int            main()
    {
      using namespace std;
    
      multimap<char, int> map;
    
      map.insert(std::pair<char, int>('a', 10));
      map.insert(std::pair<char, int>('c', 50));
      map.insert(std::pair<char, int>('b', 20));
      map.insert(std::pair<char, int>('a', 100));
    
      cout << map.count('a') << endl;
    
      for (auto& e : map)
        cout << e.first << ' ' << e.second << '\n';
    }
    
    /* stdout stderr
    2
    a 10
    a 100
    b 20
    c 50
    */
저작자표시 (새창열림)

'C++ > Library' 카테고리의 다른 글

C++ STL 알고리즘 (Algorithms)  (0) 2021.03.26
C++ STL 반복자 (Iterators)  (0) 2021.03.26
C++ map  (0) 2021.03.26
C++ multiset  (0) 2021.03.26
C++ set  (0) 2021.03.26
'C++/Library' 카테고리의 다른 글
  • C++ STL 알고리즘 (Algorithms)
  • C++ STL 반복자 (Iterators)
  • C++ map
  • C++ multiset
Caniro
Caniro
  • Caniro
    Minimalism
    Caniro
  • 전체
    오늘
    어제
    • 분류 전체보기 (317)
      • Algorithm (13)
        • 알기 쉬운 알고리즘 (10)
        • Search (1)
        • Sort (2)
      • Arduino (0)
      • C++ (185)
        • Class (46)
        • Exception (6)
        • Library (51)
        • Overloading (10)
        • SmartPointer (5)
        • Syntax (33)
        • TBC++ (23)
        • Templates (9)
        • VisualStudio (2)
      • Embedded (1)
      • Git (4)
      • Java (5)
      • Linux (16)
        • Error (1)
        • Linux Structure (11)
      • MacOS (7)
      • OS (1)
        • Concurrency (1)
      • Python (21)
        • Class (1)
        • Function (2)
        • Syntax (17)
      • Raspberrypi (9)
      • Review (1)
      • Utility (12)
        • VSCode (5)
        • VirtualBox (3)
      • Web (8)
        • Nginx (1)
        • React (3)
        • Django (1)
      • Windows (20)
        • Registry (3)
        • WSL (1)
        • DeviceDriver (6)
  • 블로그 메뉴

    • 홈
    • 태그
    • 방명록
  • 링크

  • 공지사항

  • 인기 글

  • 태그

    백기선
    citrix workspace
    Windows 11
    스프링
    windows
    dism
    spring
    Solaris 10
    윈도우 명령어
    맥북 카카오톡 알림 안뜸
    그림판
    mspaint
    MacOS
    logi options
    vscode
    윈도우
    EXCLUDE
    unix
    SunOS 5.1
    시스템 복구
    스프링 프레임워크 핵심 기술
    SFC
    KakaoTalk
    java
    Workspace
    로지텍 마우스 제스처
    제외
    알림
  • 최근 댓글

  • 최근 글

  • hELLO· Designed By정상우.v4.10.3
Caniro
C++ multimap
상단으로

티스토리툴바