码农知识堂 - 1000bd
  •   Python
  •   PHP
  •   JS/TS
  •   JAVA
  •   C/C++
  •   C#
  •   GO
  •   Kotlin
  •   Swift
  • C++ Reference: Standard C++ Library reference: Containers


    C++官网参考链接:https://cplusplus.com/reference/stl/

    库 
    Containers
    标准容器 
    容器是一个持有者对象,它存储了其他对象(其元素)的集合。它们被实现为类模板,这使得作为元素支持的类型具有很大的灵活性。
    容器管理其元素的存储空间,并提供访问它们的成员函数,可以直接或通过iterator(具有与指针类似属性的reference对象)。
    容器复制编程中非常常用的结构:动态数组(vector)、队列(queue)、堆栈(stack)、堆(priority_queue)、链表(list)、树(set)、关联数组(map)……
    许多容器有几个共同的成员函数,并共享功能。决定使用哪种类型的容器来满足特定的需求通常不仅仅取决于容器所提供的功能,还取决于它的一些成员的效率(复杂度)。对于顺序容器来说尤其如此,它们在插入/删除元素和访问元素之间提供了不同的复杂度权衡。
    stack、queue和priority_queue被实现为容器适配器。容器适配器不是完整的容器类,而是提供特定接口的类,这些接口依赖于一个容器类(如deque或list)的对象来处理元素。底层容器被封装成这样一种方式:容器适配器的成员可以独立于所使用的底层容器类访问其元素。

    容器类模板
    顺序容器:
    array    Array class (class template)
    vector    Vector (class template)
    deque    Double ended queue (class template)
    forward_list    Forward list (class template)
    list    List (class template)

    容器适配器: 
    stack    LIFO stack (class template)
    queue    FIFO queue (class template)
    priority_queue    Priority queue (class template) 

    关联容器:
    set    Set (class template)
    multiset    Multiple-key set (class template)
    map    Map (class template)
    multimap    Multiple-key map (class template)

    无序关联容器:
    unordered_set    Unordered Set (class template)
    unordered_multiset    Unordered Multiset (class template)
    unordered_map    Unordered Map (class template)
    unordered_multimap    Unordered Multimap (class template)

    其他: 
    有两个类模板与容器共享某些属性,有时与容器一起分类:bitset和valarray。 

    成员图谱 
    这是一个比较图表,每个不同的容器上都有不同的成员函数: 

    图标

    C++98Available since C++98
    C++11New in C++11

    顺序容器

    Headers
    Membersarrayvectordequeforward_listlist
    constructorimplicitvectordequeforward_listlist
    destructorimplicit~vector~deque~forward_list~list
    operator=implicitoperator=operator=operator=operator=
    iteratorsbeginbeginbeginbeginbegin
    before_begin
    begin
    endendendendendend
    rbeginrbeginrbeginrbeginrbegin
    rendrendrendrendrend
    const iteratorscbegincbegincbegincbegincbegin
    cbefore_begin
    cbegin
    cendcendcendcendcendcend
    crbegincrbegincrbegincrbegincrbegin
    crendcrendcrendcrendcrend
    capacitysizesizesizesizesize
    max_sizemax_sizemax_sizemax_sizemax_sizemax_size
    emptyemptyemptyemptyemptyempty
    resizeresizeresizeresizeresize
    shrink_to_fitshrink_to_fitshrink_to_fit
    capacitycapacity
    reservereserve
    element accessfrontfrontfrontfrontfrontfront
    backbackbackbackback
    operator[]operator[]operator[]operator[]
    atatatat
    modifiersassignassignassignassignassign
    emplaceemplaceemplaceemplace_afteremplace
    insertinsertinsertinsert_afterinsert
    eraseeraseeraseerase_aftererase
    emplace_backemplace_backemplace_backemplace_back
    push_backpush_backpush_backpush_back
    pop_backpop_backpop_backpop_back
    emplace_frontemplace_frontemplace_frontemplace_front
    push_frontpush_frontpush_frontpush_front
    pop_frontpop_frontpop_frontpop_front
    clearclearclearclearclear
    swapswapswapswapswapswap
    list operationssplicesplice_aftersplice
    removeremoveremove
    remove_ifremove_ifremove_if
    uniqueuniqueunique
    mergemergemerge
    sortsortsort
    reversereversereverse
    observersget_allocatorget_allocatorget_allocatorget_allocatorget_allocator
    datadatadata

    关联容器

    Headers
    Memberssetmultisetmapmultimapunordered_setunordered_multisetunordered_mapunordered_multimap
    constructorsetmultisetmapmultimapunordered_setunordered_multisetunordered_mapunordered_multimap
    destructor~set~multiset~map~multimap~unordered_set~unordered_multiset~unordered_map~unordered_multimap
    assignmentoperator=operator=operator=operator=operator=operator=operator=operator=
    iteratorsbeginbeginbeginbeginbeginbeginbeginbeginbegin
    endendendendendendendendend
    rbeginrbeginrbeginrbeginrbegin
    rendrendrendrendrend
    const iteratorscbegincbegincbegincbegincbegincbegincbegincbegincbegin
    cendcendcendcendcendcendcendcendcend
    crbegincrbegincrbegincrbegincrbegin
    crendcrendcrendcrendcrend
    capacitysizesizesizesizesizesizesizesizesize
    max_sizemax_sizemax_sizemax_sizemax_sizemax_sizemax_sizemax_sizemax_size
    emptyemptyemptyemptyemptyemptyemptyemptyempty
    reservereservereservereservereserve
    element accessatatat
    operator[]operator[]operator[]
    modifiersemplaceemplaceemplaceemplaceemplaceemplaceemplaceemplaceemplace
    emplace_hintemplace_hintemplace_hintemplace_hintemplace_hintemplace_hintemplace_hintemplace_hintemplace_hint
    insertinsertinsertinsertinsertinsertinsertinsertinsert
    eraseeraseeraseeraseeraseeraseeraseeraseerase
    clearclearclearclearclearclearclearclearclear
    swapswapswapswapswapswapswapswapswap
    operationscountcountcountcountcountcountcountcountcount
    findfindfindfindfindfindfindfindfind
    equal_rangeequal_rangeequal_rangeequal_rangeequal_rangeequal_rangeequal_rangeequal_rangeequal_range
    lower_boundlower_boundlower_boundlower_boundlower_bound
    upper_boundupper_boundupper_boundupper_boundupper_bound
    observersget_allocatorget_allocatorget_allocatorget_allocatorget_allocatorget_allocatorget_allocatorget_allocatorget_allocator
    key_compkey_compkey_compkey_compkey_comp
    value_compvalue_compvalue_compvalue_compvalue_comp
    key_eqkey_eqkey_eqkey_eqkey_eq
    hash_functionhash_functionhash_functionhash_functionhash_function
    bucketsbucketbucketbucketbucketbucket
    bucket_countbucket_countbucket_countbucket_countbucket_count
    bucket_sizebucket_sizebucket_sizebucket_sizebucket_size
    max_bucket_countmax_bucket_countmax_bucket_countmax_bucket_countmax_bucket_count
    hash policyrehashrehashrehashrehashrehash
    load_factorload_factorload_factorload_factorload_factor
    max_load_factormax_load_factormax_load_factormax_load_factormax_load_factor
  • 相关阅读:
    AprilTag在相机标定中的应用简介
    如何将枯燥的大数据进行可视化处理?
    Linux设备驱动模型之字符设备
    GIS工具maptalks开发手册(四)02——渲染地图信息框之添加绘制工具 & 获取面的坐标数据信息框进行展示 & 渲染图片的两种方式
    金融帝国实验室(CapLab)官方更新_V9.1.15版本(2023年第64次)
    pgbackrest归档目录满,清理后写入仍报错,分析及处理
    数据结构----并查集
    PHP8的类与对象的基本操作之类的实例化-PHP8知识详解
    强化学习 (三) 动态规划
    C++中变量是按值访问的, Python 中变量的值是按引用访问的示例说明
  • 原文地址:https://blog.csdn.net/weixin_40186813/article/details/127520894
  • 最新文章
  • 【JVM】编译执行与解释执行的区别是什么?JVM 使用哪种方式?
    用 Hashids 优雅解决 C 端自增 ID 暴露问题
    V8引擎 精品漫游指南--Ignition篇(上) 指令 栈帧 槽位 调用约定 内存布局 基础内容
    LLVM Pass快速入门(四):代码插桩
    milkup:桌面端 markdown AI续写和即时渲染
    基于项目工程构建SBOM(软件物料清单)的研究
    鸿蒙应用开发UI基础第二节:鸿蒙应用程序框架核心解析与实操
    .NET 中如何快速实现 List 集合去重?
    扣子Coze实战:从0到1打造抖音+小红书热点监控智能体
    浅谈数据访问层
  • 热门文章
  • 十款代码表白小特效 一个比一个浪漫 赶紧收藏起来吧!!!
    奉劝各位学弟学妹们,该打造你的技术影响力了!
    五年了,我在 CSDN 的两个一百万。
    Java俄罗斯方块,老程序员花了一个周末,连接中学年代!
    面试官都震惊,你这网络基础可以啊!
    你真的会用百度吗?我不信 — 那些不为人知的搜索引擎语法
    心情不好的时候,用 Python 画棵樱花树送给自己吧
    通宵一晚做出来的一款类似CS的第一人称射击游戏Demo!原来做游戏也不是很难,连憨憨学妹都学会了!
    13 万字 C 语言从入门到精通保姆级教程2021 年版
    10行代码集2000张美女图,Python爬虫120例,再上征途
小工具 小游戏
Copyright © 2022 侵权请联系2656653265@qq.com    京ICP备2022015340号-1

京公网安备 11010502049817号