Namespaces
Variants
Actions

std::basic_stacktrace<Allocator>::empty

From cppreference.com
 
C++
 
Diagnostics library
 
std::basic_stacktrace
bool empty() const noexcept;
(since C++23)

Checks if the stacktrace has no stacktrace entries.

Contents

[edit] Parameters

(none)

[edit] Return value

true if the stacktrace is empty, false otherwise.

[edit] Complexity

Constant.

[edit] 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

[edit] See also

returns the number of stacktrace entries
(public member function) [edit]

Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant