Beginner's Guide
    First Steps
    Input & Output
    Basic Custom Types
    Diagnostics
    Standard Library
    Code Organization
    Powerful Custom Types
    Generic Programming
    Memory Management
    Software Design Basics

    Standard Associative ContainersAssociative ContainersAssociative Containers

    set<Key>

    stores unique keys; sorted by keys

    map<Key,Value>

    stores unique key→value-pairs; sorted by keys

    unordered_set<Key>

    stores unique keys; hashed by keys

    unordered_map<Key,Value>

    stores unique key→value-pairs; hashed by keys

    Containers that allow non-unique keys:
    • multiset
    • multimap
    • unordered_multiset
    • unordered_multimap

    std::pair<First,Second> std::pair

    • contains two values of different or same type
    • standard map containers std::map, std::unordered_map, etc. store pairs of type std::pair<const Key,Value>
    #include <utility>
    
    std::pair<int,double> p {4, 8.15};
    
    std::cout << p.first  <<'\n';   // 4
    std::cout << p.second <<'\n';   // 8.15
    
    //  type deduction:
    std::pair p2 {4, 8.15};   // std::pair<int,double>

    Slides