標準ライブラリヘッダ <array>
提供: cppreference.com
このヘッダはコンテナライブラリの一部です。
インクルード | ||
(C++20) | 三方比較演算子サポート | |
(C++11) | std::initializer_list クラステンプレート | |
クラス | ||
(C++11) | 要素が隣接した静的な配列 (クラステンプレート) | |
array のサイズを取得します (クラステンプレートの特殊化) | ||
array の要素の型を取得します (クラステンプレートの特殊化) | ||
関数 | ||
(C++20で削除)(C++20で削除)(C++20で削除)(C++20で削除)(C++20で削除)(C++20) | array 内の値を辞書的に比較します (関数テンプレート) | |
(C++11) | std::swap アルゴリズムの特殊化 (関数テンプレート) | |
(C++20) | 組み込みの配列から std::array オブジェクトを作成します (関数テンプレート) | |
array の要素にアクセスします (関数テンプレート) | ||
範囲アクセス | ||
(C++11)(C++14) | コンテナまたは配列の先頭を指すイテレータを返します (関数) | |
(C++11)(C++14) | コンテナまたは配列の終端を指すイテレータを返します (関数) | |
(C++14) | コンテナまたは配列の先頭を指す逆イテレータを返します (関数) | |
(C++14) | コンテナまたは配列の終端を指す逆イテレータを返します (関数) | |
(C++17)(C++20) | コンテナまたは配列のサイズを返します (関数テンプレート) | |
(C++17) | コンテナが空かどうか調べます (関数) | |
(C++17) | ベースとなる配列を指すポインタを取得します (関数) |
[編集]概要
#include <compare>#include <initializer_list> namespace std {// class template arraytemplate<class T, size_t N>struct array; template<class T, size_t N>constexprbool operator==(const array<T, N>& x, const array<T, N>& y);template<class T, size_t N>constexpr/*synth-three-way-result*/<T> operator<=>(const array<T, N>& x, const array<T, N>& y); // specialized algorithmstemplate<class T, size_t N>constexprvoid swap(array<T, N>& x, array<T, N>& y)noexcept(noexcept(x.swap(y))); // array creation functionstemplate<class T, size_t N>constexpr array<remove_cv_t<T>, N> to_array(T (&a)[N]);template<class T, size_t N>constexpr array<remove_cv_t<T>, N> to_array(T (&&a)[N]); // tuple interfacetemplate<class T>struct tuple_size;template<size_t I, class T>struct 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>constexpr T& get(array<T, N>&)noexcept;template<size_t I, class T, size_t N>constexpr T&& get(array<T, N>&&)noexcept;template<size_t I, class T, size_t N>constexprconst T& get(const array<T, N>&)noexcept;template<size_t I, class T, size_t N>constexprconst T&& get(const array<T, N>&&)noexcept;}
[編集]クラステンプレート std::array
namespace std {template<class T, size_t N>struct array {// typesusing value_type = T;using pointer = T*;using const_pointer =const T*;using reference = T&;using const_reference =const T&;using size_type = size_t;using difference_type = ptrdiff_t;using iterator =/* implementation-defined */;using const_iterator =/* implementation-defined */;using reverse_iterator =std::reverse_iterator<iterator>;using const_reverse_iterator =std::reverse_iterator<const_iterator>; // no explicit construct/copy/destroy for aggregate type constexprvoid fill(const T& u);constexprvoid swap(array&)noexcept(is_nothrow_swappable_v<T>); // iteratorsconstexpr iterator begin()noexcept;constexpr const_iterator begin()constnoexcept;constexpr iterator end()noexcept;constexpr const_iterator end()constnoexcept; constexpr reverse_iterator rbegin()noexcept;constexpr const_reverse_iterator rbegin()constnoexcept;constexpr reverse_iterator rend()noexcept;constexpr const_reverse_iterator rend()constnoexcept; constexpr const_iterator cbegin()constnoexcept;constexpr const_iterator cend()constnoexcept;constexpr const_reverse_iterator crbegin()constnoexcept;constexpr const_reverse_iterator crend()constnoexcept; // capacity[[nodiscard]]constexprbool empty()constnoexcept;constexpr size_type size()constnoexcept;constexpr size_type max_size()constnoexcept; // element accessconstexpr reference operator[](size_type n);constexpr const_reference operator[](size_type n)const;constexpr reference at(size_type n);constexpr const_reference at(size_type n)const;constexpr reference front();constexpr const_reference front()const;constexpr reference back();constexpr const_reference back()const; constexpr T * data()noexcept;constexprconst T * data()constnoexcept;}; template<class T, class... U> array(T, U...)-> array<T, 1+ sizeof...(U)>;}