std::queue::size(3)
πΈ NAME πΈ
okay bestie, welcome to std::queue::size(3) from the C++ Standard Libary π (yes, that exact manual name, typo and all, we're keeping it). This page is about std::queue::size β literally std::queue::size β the member function that tells you how many elements are hanging out in your container adaptor. No cap, that's the whole assignment. β¨
π¦ Synopsis π¦
size_type size() const;
Returns the number of elements in the container adaptor. Equivalent to return c.size().
That's the vibe. Short, iconic, to the point. π
π Parameters π
(none)β zero args, bestie. Not a single parameter in sight π
β¨ Return value β¨
The number of elements in the container adaptor. That's it. That's the tea. π
π₯ Complexity π₯
Constant. No scaling drama, just constant energy. β
π Example π
Run this code, bestie:
// Run this code
#include <algorithm>
#include <cassert>
#include <queue>
int main()
{
std::queue<int> queue;
assert(queue.size() == 0);
const int count = 8;
for (int i = 0; i != count; ++i)
queue.push(i);
assert(queue.size() == count);
}
π See also π
emptyβ checks whether the container adaptor is empty (public member function)sizessizeβ returns the size of a container or array(C++17)(function template)(C++20)
source is http://cppreference.com, version/date is 2024.06.10 β and that's the whole page, bestie, mwah πβ¨
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms