std::basic_stacktrace<Allocator>::empty
From cppreference.com
< cpp | utility | basic stacktrace
C++
Feature test macros (C++20)
Concepts library (C++20)
Metaprogramming library (C++11)
Ranges library (C++20)
Filesystem library (C++17)
Concurrency support library (C++11)
Execution control library (C++26)
Diagnostics library
(until C++20*)
(C++17)(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
Exception handling failures
(C++11)
(until C++17*)
(until C++17*)
(until C++17*)
(until C++17*)
(TM TS)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++23)
(C++23)
(C++26)
(C++26)
(C++26)
std::basic_stacktrace
basic_stacktrace::empty
bool empty() const noexcept;
(since C++23)
Checks if the stacktrace has no stacktrace entries.
[edit] Parameters
(none)
[edit] Return value
true if the stacktrace is empty, false otherwise.
[edit] Complexity
Constant.
[edit] 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