栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

C++STL序列容器array

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

C++STL序列容器array

C++STL序列容器
  • array(C++11)
  • Iterators
    • begin,rbegin,cbegin,crbegin
    • end,rend,cend,crend
  • Capacity
    • size
    • max_size
    • empty
  • Element access
    • operator[]
    • at
    • front
    • back
    • data
  • Modifiers
    • fill
    • swap

作为 cppreference以及 cplusplus的补充说明笔记。记录使用STL过程中cppreference文档示例没有举例的地方,以及重要知识点总结。

array(C++11)

固定大小的数组。

Iterators begin,rbegin,cbegin,crbegin end,rend,cend,crend Capacity size

返回元素数。

constexpr size_type size() noexcept;
max_size

返回array所能容纳最大元素数。

constexpr size_type max_size() noexcept;
empty

return size==0

constexpr bool empty() noexcept;
Element access operator[]
      reference operator[] (size_type n);
const_reference operator[] (size_type n) const;
at

边界检查。

      reference at ( size_type n );
const_reference at ( size_type n ) const;
front

返回直接引用,空容器使用将未定义。

      reference front();
const_reference front() const;
back

返回直接引用,空容器使用将未定义。

      reference back();
const_reference back() const;
data

返回数组指针。

      value_type* data() noexcept;
const value_type* data() const noexcept;
Modifiers fill

val填充数组

void fill (const value_type& val);
swap

对于每个元素执行交换操作。

void swap (array& x) noexcept(noexcept(swap(declval(),declval())));
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/334887.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号