std::basic_...c_stacktrace(3)
π NAME π
okay bestie, this is the std::basic_...c_stacktrace(3) page from the <pink>C++ Standard Libary</pink> manual (their spelling, not mine π), and it's all about std::basic_stacktrace::basic_stacktrace β yes, the constructor squad for std::basic_stacktrace. every overload here is (since C++23), so it's giving shiny new standard energy β¨π
πΈ SYNOPSIS πΈ
here's the exact synopsis, weird wrapping and all, no cap:
basic_stacktrace() noexcept(/* see below */);
(1) (since C++23)
explicit basic_stacktrace( const allocator_type& alloc ) noexcept;
(2) (since C++23)
basic_stacktrace( const basic_stacktrace& other );
(3) (since C++23)
basic_stacktrace( basic_stacktrace&& other ) noexcept;
(4) (since C++23)
basic_stacktrace( const basic_stacktrace& other,
(5) (since C++23)
const allocator_type& alloc );
basic_stacktrace( basic_stacktrace&& other, const allocator_type&
(6) (since C++23)
alloc );
so the whole vibe is: it constructs an empty basic_stacktrace, or it copies/moves from other. lowkey iconic constructor behavior π«Ά
- Overload (1) β default constructor. Constructs an empty
basic_stacktracewith a default-constructed allocator. - Overload (2). Constructs an empty
basic_stacktraceusingallocas the allocator. - Overload (3) β copy constructor. Constructs a
basic_stacktracewith the copy of the contents ofother; the allocator is obtained as if by callingstd::allocator_traits<allocator_type>::select_on_container_copy_construction(other.get_allocator()). - Overload (4) β move constructor. Constructs a
basic_stacktracewith the contents ofotherusing move semantics. Allocator is move-constructed from that ofother. After construction,otheris left in a valid but unspecified state. - Overload (5). Same as the copy constructor, except that
allocis used as the allocator. - Overload (6). Behaves same as the move constructor if
alloc == other.get_allocator(). Otherwise, allocates memory withallocand performs element-wise move.allocis used as the allocator.
(3,5,6)may throw an exception or construct an emptybasic_stacktraceon allocation failure. not me being dramatic about allocation, but that's literally what it says π
π PARAMETERS π
allocβ allocator to use for all memory allocations of the constructedbasic_stacktrace.otherβ anotherbasic_stacktraceto copy/move from.
π EXCEPTIONS π
- Overload (1).
noexceptspecification:noexcept(std::is_nothrow_default_constructible_v<allocator_type>) - Overloads 3, 5, 6. May propagate the exception thrown on allocation failure.
β‘ COMPLEXITY β‘
- 1, 2. Constant.
- 3. Linear in size of
other. - 4. Constant.
- 5. Linear in size of
other. - 6. Linear in size of
otherifalloc != other.get_allocator(), otherwise constant.
π NOTES π
After container move construction (overload (4)), references, pointers, and iterators (other than the end iterator) to other remain valid, but refer to elements that are now in *this. The current standard makes this guarantee via the blanket statement in [container.reqmts]/67, and a more direct guarantee is under consideration via LWG issue 2321.
π EXAMPLE π
This section is incomplete.
Reason: no example.
π SEE ALSO π
operator=β assigns to thebasic_stacktrace(public member function).currentβ obtains the current stacktrace or its given part,[static](public static member function).
π·οΈ CATEGORIES π·οΈ
- conditionally
noexcept - Todo no example
and that's the whole vibe β source/version/date cuteness: http://cppreference.com, 2024.06.10, page std::basic_...c_stacktrace(3). byeee, go construct something iconic π
β¨
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms