STD::ARRAY(3)

🌸 std::array< _Tp, _Nm > β€” Library Functions Manual 🌸

okay bestie, sit down, we're talking about std::array< _Tp, _Nm > today and it is literally one of the most underrated glow-ups in the whole standard library πŸ’… (this page lives in the Library Functions Manual btw, so you know it's official)


✨ NAME ✨

std::array< _Tp, _Nm > β€” a standard container for storing a fixed size sequence of elements. that's it. that's the girl. fixed size, no resizing, no drama πŸŽ€


✨ SYNOPSIS ✨

#include <array>

πŸ¦‹ Public Types

these are the little nickname aliases, the alter egos, the stan accounts:

typedef const value_type * const_iterator
typedef const value_type * const_pointer
typedef const value_type & const_reference
typedef std::reverse_iterator< const_iterator > const_reverse_iterator
typedef std::ptrdiff_t difference_type
typedef value_type * iterator
typedef value_type * pointer
typedef value_type & reference
typedef std::reverse_iterator< iterator > reverse_iterator
typedef std::size_t size_type
typedef _Tp value_type

πŸ¦‹ Public Member Functions

the whole friend group, in order, exactly as they appear:

constexpr reference at (size_type __n)
constexpr const_reference at (size_type __n) const
constexpr const_reference back () const noexcept
constexpr reference back () noexcept
constexpr const_iterator begin () const noexcept
constexpr iterator begin () noexcept
constexpr const_iterator cbegin () const noexcept
constexpr const_iterator cend () const noexcept
constexpr const_reverse_iterator crbegin () const noexcept
constexpr const_reverse_iterator crend () const noexcept
constexpr const_pointer data () const noexcept
constexpr pointer data () noexcept
constexpr bool empty () const noexcept
constexpr const_iterator end () const noexcept
constexpr iterator end () noexcept
constexpr void fill (const value_type &__u)
constexpr const_reference front () const noexcept
constexpr reference front () noexcept
constexpr size_type max_size () const noexcept
constexpr const_reference operator[] (size_type __n) const noexcept
constexpr reference operator[] (size_type __n) noexcept
constexpr const_reverse_iterator rbegin () const noexcept
constexpr reverse_iterator rbegin () noexcept
constexpr const_reverse_iterator rend () const noexcept
constexpr reverse_iterator rend () noexcept
constexpr size_type size () const noexcept
constexpr void swap (array &__other) noexcept(__array_traits< _Tp, _Nm
    >::_Is_nothrow_swappable::value)

πŸ¦‹ Public Attributes

just the one, and she's the whole personality:

__array_traits< _Tp, _Nm >::_Type _M_elems

✨ Detailed Description ✨

template<typename _Tp, std::size_t _Nm>
    struct std::array< _Tp, _Nm >

"A standard container for storing a fixed size sequence of elements."

and like, it's not just some random struct, bestie β€” it meets the requirements of a container, a reversible container, and a sequence. triple threat. main character energy fr fr πŸ‘‘

also: it sets support for random access iterators. yes. the iterators can jump around. iconic.

πŸ’– Template Parameters

  • Tp β€” the type of element. required to be a complete type, no half-finished business allowed πŸ™ˆ
  • Nm β€” the number of elements.

✨ Author ✨

generated automatically by Doxygen for libstdc++ from the source code. so technically nobody "wrote" this, it just appeared, like a butterfly πŸ¦‹


okay so real talk for a sec: this page is the libstdc++ version of std::array, documented by Doxygen, and everything above is exactly what the docs say β€” no cap, don't let my vibe fool you into thinking I added anything πŸ’–

that's the whole page, bestie. fixed size, constexpr everything, noexcept where it counts, and a _M_elems holding it all together. slay. 🌈⭐🌸

β€” libstdc++ 🫢 (source + version, straight from the footer, mwah πŸ’…)

πŸ“¦ where this page comes from
  • arch rolling: gcc 16.2.1+r23+gd564253eb6c8-1 Β· GPL-3.0-or-later WITH GCC-exception-3.1 AND GFDL-1.3-or-later
  • fedora 44: libstdc++-docs 16.0.1-0.10.fc44 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl AND Martin-Birgmeier AND HPND-Markus-Kuhn AND dtoa AND SMLNJ AND AMD-newlib AND OAR AND HPND-merchantability-variant AND HPND-Intel
  • fedora 44: libstdc++-docs 16.2.1-2.fc44
  • fedora 44: libstdc++-docs 16.2.1-3.fc44 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl AND Martin-Birgmeier AND HPND-Markus-Kuhn AND dtoa AND SMLNJ AND AMD-newlib AND OAR AND HPND-merchantability-variant AND HPND-Intel
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms