std::priority_queue::size(3)
okay so bestie, welcome to the C++ Standard Libary manual, section 3 β this is the page for std::priority_queue::size, and weβre gonna make it make sense π
π NAME π
std::priority_queue::size - std::priority_queue::size β yes, the name really said βIβm my own twinβ and honestly? iconic.
β¨ Synopsis β¨
size_type size() const;
It returns the number of elements in the container adaptor. Equivalent to return c.size(). no cap, thatβs the whole move π«Ά
π Parameters π
(none)β literally zero args, bestie. not a single one. π
πΈ Return value πΈ
The number of elements in the container adaptor. thatβs it, thatβs the tea π
π¦ Complexity π¦
Constant. lowkey refreshing, fr fr β¨
π§ Example π§
this snippet is giving βrun me and seeβ energy:
// Run this code
#include <algorithm>
#include <cassert>
#include <queue>
int main()
{
std::priority_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)size/ssizeβ returns the size of a container or array(C++17)(function template)(C++20)
mwah π source/version: http://cppreference.com, date: 2024.06.10, page: std::priority_queue::size(3) β bestie, you ate this manual page up, periodt ππ
π¦ 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