std::basic_...race::empty(3)
πΈ NAME πΈ
std::basic_stacktrace::empty β okay bestie, this is the std::basic_stacktrace::empty(3) page, all about the std::basic_stacktrace::empty member function, straight from the C++ Standard Libary manual, and it's here to answer one very specific question: is your stacktrace empty? No cap. π
π¦ Synopsis π¦
[[nodiscard]] bool empty() const noexcept;
β¨ since C++23 β¨
It checks if the stacktrace has no stacktrace entries.
π Parameters π
- (none) β literally no parameters, bestie. Zero. Nada. π«Ά
π Return value π
true if the stacktrace is empty, false otherwise. That's the whole answer, periodt.
β Complexity β
Constant. Yep β constant energy, no dramatic scaling arc. π
π₯ Example π₯
// Run this code
#include <stacktrace>
#include <iostream>
int main()
{
std::cout << std::boolalpha;
std::stacktrace bktr;
std::cout << "Initially, bktr.empty(): " << bktr.empty() << '\n';
bktr = std::stacktrace::current();
std::cout << "After getting entries, bktr.empty(): " <<
bktr.empty() << '\n';
}
Possible output:
Initially, bktr.empty(): true
After getting entries, bktr.empty(): false
it's giving "empty at first, then full of entries" and honestly? iconic. π
π See also π
sizeβ returns the number of stacktrace entries (public member function).
π source/version: http://cppreference.com Β· date: 2024.06.10 π
π¦ 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