Sequences(3)

πŸ“¦ version 4.4.0, in nixpkgs unstable

🌸 NAME 🌸

Hey bestie!! Welcome to Sequences(3) from the Library Functions Manual β€” yes, the libstdc++ sequence-container squad is here, and it is literally giving organized linear order energy πŸ’–

Sequences is the page for the sequence containers. Here’s the whole iconic lineup:

πŸŽ€ Classes πŸŽ€

  • struct std::array< _Tp, _Nm > β€” A standard container for storing a fixed size sequence of elements. fixed size means fixed size, bestie πŸ’…
  • class std::basic_string< _CharT, _Traits, _Alloc > β€” Managing sequences of characters and character-like objects. character-like objects have entered the chat ✨
  • class std::deque< _Tp, _Alloc > β€” A standard container using fixed-size memory allocation and constant-time manipulation of elements at either end. both ends stay speedy πŸ¦‹
  • class std::forward_list< _Tp, _Alloc > β€” A standard container with linear time access to elements, and fixed time insertion/deletion at any point in the sequence. linear access, fixed-time insert/delete πŸŽ€
  • class std::list< _Tp, _Alloc > β€” A standard container with linear time access to elements, and fixed time insertion/deletion at any point in the sequence. same energy as forward_list, different container 🌸
  • class std::priority_queue< _Tp, _Sequence, _Compare > β€” A standard container automatically sorting its contents. it sorts itself, main character behavior fr fr πŸ‘‘
  • class std::queue< _Tp, _Sequence > β€” A standard container giving FIFO behavior. first in, first out, no cap πŸ“
  • class std::stack< _Tp, _Sequence > β€” A standard container giving FILO behavior. first in, last out, iconic 🧚
  • class std::vector< _Tp, _Alloc > β€” A standard container which offers fixed time access to individual elements in any order. fixed-time access, any order ⭐
  • class std::vector< bool, _Alloc > β€” A specialization of vector for booleans which offers fixed time access to individual elements in any order. yes, booleans get their own vector moment πŸ’€

πŸ’« Detailed Description πŸ’«

Sequences arrange a collection of objects into a strictly linear order. Periodt.

The differences between sequences are usually due to one or both of the following:

  • memory management
  • algorithmic complexity

As an example of the first case, vector is required to use a contiguous memory layout, while other sequences such as deque are not. contiguous vs not-contiguous: the vibe check 🫢

The prime reason for choosing one sequence over another should be based on the second category of differences, algorithmic complexity. For example, if you need to perform many inserts and removals from the middle of a sequence, list would be ideal. But if you need to perform constant-time access to random elements of the sequence, then list should not be used. bestie, please do not use list for that 😭

All sequences must meet certain requirements, summarized in tables. tables have entered the group chat ✨


πŸ‘‘ Author πŸ‘‘

Generated automatically by Doxygen for libstdc++ from the source code. the robot author did its thing πŸ€–πŸ’…


Bye bestie β€” this page is brought to you by libstdc++, dated 21 Apr 2009, and filed under Sequences(3). slay and read the docs πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from