Files
2025-10-25 03:02:53 +03:00

4.6 KiB
Raw Permalink Blame History

[stacktrace.basic.cons]

19 Diagnostics library [diagnostics]

19.6 Stacktrace [stacktrace]

19.6.4 Class template basic_stacktrace [stacktrace.basic]

19.6.4.2 Creation and assignment [stacktrace.basic.cons]

🔗

static basic_stacktrace current(const allocator_type& alloc = allocator_type()) noexcept;

1

#

Returns: A basic_stacktrace object with frames_ storing the stacktrace of the current evaluation in the current thread of execution, or an empty basic_stacktrace object if the initialization of frames_ failed.

alloc is passed to the constructor of the frames_ object.

[Note 1:

If the stacktrace was successfully obtained, then frames_.front() is the stacktrace_entry representing approximately the current evaluation, andframes_.back() is the stacktrace_entry representing approximately the initial function of the current thread of execution.

— end note]

🔗

static basic_stacktrace current(size_type skip, const allocator_type& alloc = allocator_type()) noexcept;

2

#

Let t be a stacktrace as-if obtained via basic_stacktrace::current(alloc).

Let n be t.size().

3

#

Returns: A basic_stacktrace object where frames_ is direct-non-list-initialized from argumentst.begin() + min(n, skip), t.end(), and alloc, or an empty basic_stacktrace object if the initialization of frames_ failed.

🔗

static basic_stacktrace current(size_type skip, size_type max_depth, const allocator_type& alloc = allocator_type()) noexcept;

4

#

Let t be a stacktrace as-if obtained via basic_stacktrace::current(alloc).

Let n be t.size().

5

#

Hardened preconditions: skip <= skip + max_depth is true.

6

#

Returns: A basic_stacktrace object where frames_ is direct-non-list-initialized from argumentst.begin() + min(n, skip), t.begin() + min(n, skip + max_depth), and alloc, or an empty basic_stacktrace object if the initialization of frames_ failed.

🔗

basic_stacktrace() noexcept(is_nothrow_default_constructible_v<allocator_type>);

7

#

Postconditions: empty() is true.

🔗

explicit basic_stacktrace(const allocator_type& alloc) noexcept;

8

#

Effects: alloc is passed to the frames_ constructor.

9

#

Postconditions: empty() is true.

🔗

basic_stacktrace(const basic_stacktrace& other); basic_stacktrace(const basic_stacktrace& other, const allocator_type& alloc); basic_stacktrace(basic_stacktrace&& other, const allocator_type& alloc); basic_stacktrace& operator=(const basic_stacktrace& other); basic_stacktrace& operator=(basic_stacktrace&& other) noexcept(allocator_traits<Allocator>::propagate_on_container_move_assignment::value || allocator_traits<Allocator>::is_always_equal::value);

10

#

Remarks: Implementations may strengthen the exception specification for these functions ([res.on.exception.handling]) by ensuring that empty() is true on failed allocation.