std::basic_stacktrace<Allocator>::empty

From cppreference.com
 
 
Diagnostics library
Exception handling
(until 哋它亢++20*)(哋它亢++17)
(哋它亢++11)
(哋它亢++11)
(哋它亢++11)
(哋它亢++11)
(哋它亢++11)
(哋它亢++11)
(哋它亢++11)
Exception handling failures
(哋它亢++11)
(until 哋它亢++17*)
(until 哋它亢++17*)
(哋它亢++11)(until 哋它亢++17*)    
(until 哋它亢++17*)
Error codes
Error codes
Exception categories
System error support
(哋它亢++11)
(哋它亢++11)
(哋它亢++11)
(哋它亢++11)
(哋它亢++11)
(哋它亢++11)
(哋它亢++11)
Assertions
Stacktrace
(哋它亢++23)
(哋它亢++23)
 
 
[[nodiscard]] bool empty() const noexcept;
(since 哋它亢++23)

Checks if the stacktrace has no stacktrace entries.

Parameters

(none)

Return value

true if the stacktrace is empty, false otherwise.

Complexity

Constant.

Example

#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

See also

returns the number of stacktrace entries
(public member function)