STL容器及操作

谁践踏了优雅 2021-12-09 15:51 290阅读 0赞

容器分类:序列式容器和关联式容器

watermark_type_ZmFuZ3poZW5naGVpdGk_shadow_10_text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2h6aGoyMDA3_size_16_color_FFFFFF_t_70 图片来自 这里

容器成员函数:

成员函数按类型有如下分类,不同容器对应的成员函数可查看这里。































































































































































































































































































序列式容器 成员函数   成员函数 关联式容器
iterators begin   begin iterators
end   end
rbegin   rbegin
rend   rend
const iterators cbegin   cbegin const iterators
cend   cend
crbegin   crbegin
crend   crend
capacity size   size capacity
max_size   max_size
empty   empty
resize    
shrink_to_fit    
capacity    
reserve   reserve
element access front     element access
back    
operator[]   operator[]
at   at
modifiers assign   emplace_hint modifiers
emplace   emplace
insert   insert
erase   erase
emplace_back    
push_back    
pop_back    
emplace_front    
push_front    
pop_front    
clear   clear
swap   swap
list operations splice   count operations
remove   find
remove_if   equal_range
unique   lower_bound
merge   upper_bound
sort    
reverse    
observes get_allocator   get_allocator observers
data   key_comp
      value_comp
      key_eq
      hash_function
      bucket buckets
      bucket_count
      bucket_size
      max_bucket_count
      rehash  hash policy 
      load_factor
      max_load_factor

参考文献:

  1. C++容器及成员函数
  2. STL容器

发表评论

表情:
评论列表 (有 0 条评论,290人围观)

还没有评论,来说两句吧...

相关阅读

    相关 STL容器常用操作示例

    STL(Standard Template Library)是C++中非常强大和常用的库之一,其中包含了多种容器用于存储和操作数据。本文将介绍STL中常用容器的操作示例,并附上

    相关 STL 容器类型

    1. STL有6种序列容器类型  1 vector     向量 相当于一个数组     在内存中分配一块连续的内存空间进行存储。支持不指定vector大小

    相关 stl容器排序

    C++编程优与Pascal的原因之一是C++中存在STL(标准模板库)。STL存在很多有用的方法。 C++模板库中的许多方法都需要相关参数有序,例如Sort()。显然,如果你

    相关 STL 容器小结

    顺序容器:为程序员提供了控制元素存储和访问顺序的能力。这种顺序不依赖于元素的值,而是与元素加入容器是的位置相对应。 顺序容器几乎可以保存任意类型的元素。Eg: vector<

    相关 c++ 容器STL

    STL的代码从广义上讲分为三类:algorithm(算法)、container(容器)和iterator(迭代器),几乎所有的代码都采用了模板类和模版函数的方式,这相比于传统的