array
标准库标头<array>
此标头是集装箱图书馆。
包括
*。
<初始化器[医]列表>%28C++11%29
班
数组%28自C++11%29静态连续数组%28类模板%29
STD::元组[医]Size<std::Array>获得数组%28类模板专门化%29的大小
STD::元组[医]元素<std::Array>获取数组%28类模板专门化%29中元素的类型
功能
运算符==运算符%21=运算符<运算符<=运算符>>=按字典顺序比较数组%28函数模板%29中的值
获取%28 std::Array%29访问数组%28函数模板%29的元素
调换%28std::Array%29%28C++11%29专门使用std::swp算法%28函数模板%29
简介
二次
#include <initializer_list>
namespace std {
template <class T, size_t N > struct array;
template <class T, size_t N>
bool operator==(const array<T,N>& x, const array<T,N>& y
template <class T, size_t N>
bool operator!=(const array<T,N>& x, const array<T,N>& y
template <class T, size_t N>
bool operator<(const array<T,N>& x, const array<T,N>& y
template <class T, size_t N>
bool operator>(const array<T,N>& x, const array<T,N>& y
template <class T, size_t N>
bool operator<=(const array<T,N>& x, const array<T,N>& y
template <class T, size_t N>
bool operator>=(const array<T,N>& x, const array<T,N>& y
template <class T, size_t N >
void swap(array<T,N>& x, array<T,N>& y) noexcept(noexcept(x.swap(y))
template <class T> class tuple_size;
template <size_t I, class T> class tuple_element;
template <class T, size_t N> struct tuple_size<array<T, N> >;
template <size_t I, class T, size_t N> struct tuple_element<I, array<T, N> >;
template <size_t I, class T, size_t N> T& get(array<T, N>&) noexcept;
template <size_t I, class T, size_t N> T&& get(array<T, N>&&) noexcept;
template <size_t I, class T, size_t N> const T& get(const array<T, N>&) noexcept;
}
二次
类std::array
二次
template <class T, size_t N >
struct array {
// types:
typedef T& reference;
typedef const T& const_reference;
typedef /*implementation-defined*/ iterator;
typedef /*implementation-defined*/ const_iterator;
typedef size_t size_type;
typedef ptrdiff_t difference_type;
typedef T value_type;
typedef T* pointer;
typedef const T* const_pointer;
typedef reverse_iterator<iterator> reverse_iterator;
typedef reverse_iterator<const_iterator> const_reverse_iterator;
T elems[N]; // exposition only
// no explicit construct/copy/destroy for aggregate type
void fill(const T& u
void swap(array<T, N>&) noexcept(noexcept(swap(declval<T&>(), declval<T&>()))
// iterators:
iterator begin() noexcept;
const_iterator begin() const noexcept;
iterator end() noexcept;
const_iterator end() const noexcept;
reverse_iterator rbegin() noexcept;
const_reverse_iterator rbegin() const noexcept;
reverse_iterator rend() noexcept;
const_reverse_iterator rend() const noexcept;
const_iterator cbegin() noexcept;
const_iterator cend() noexcept;
const_reverse_iterator crbegin() const noexcept;
const_reverse_iterator crend() const noexcept;
// capacity:
constexpr size_type size() noexcept;
constexpr size_type max_size() noexcept;
constexpr bool empty() noexcept;
// element access:
reference operator[](size_type n
const_reference operator[](size_type n) const;
const_reference at(size_type n) const;
reference at(size_type n
reference front(
const_reference front() const;
reference back(
const_reference back() const;
T * data() noexcept;
const T * data() const noexcept;
};
二次
注
变量array::elems
仅用于公开,它不属于接口的一部分。
© cppreference.com
在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。