[[nodiscard]] bool empty() const noexcept; | (since C++23) |
Checks if the stacktrace has no stacktrace entries.
(none).
true
if the stacktrace is empty, false
otherwise.
Constant.
#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
(C++23) | returns the number of stacktrace entries (public member function) |
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
https://en.cppreference.com/w/cpp/utility/basic_stacktrace/empty