std::basic_...::operator=(3)
π NAME π
Okay so bestie, this is std::basic_stacktrace::operator= β literally std::basic_stacktrace::operator= β straight out of the C++ Standard Libary manual. It's giving assignment-operator main character energy, and both overloads are since C++23. No cap. π«Ά
πΈ Synopsis πΈ
basic_stacktrace& operator=( const basic_stacktrace& other ); (1)
(since C++23)
basic_stacktrace& operator=( basic_stacktrace&& other ) (2)
(since C++23)
noexcept(/* see below */);
This replaces the contents of the basic_stacktrace.
- (1) Copy assignment operator. Replaces the contents with a copy of the contents of
other. Ifstd::allocator_traits<allocator_type>::propagate_on_container_copy_assignment::valueistrue, the allocator of*thisis replaced by a copy of that ofother. If the allocator of*thisafter assignment would compare unequal to its old value, the old allocator is used to deallocate the memory, then the new allocator is used to allocate it before copying the entries. Otherwise, the memory owned by*thismay be reused when possible. - (2) Move assignment operator. Replaces the contents with those of
otherusing move semantics (i.e. the data inotheris moved fromotherinto*this).otheris in a valid but unspecified state afterwards. Ifstd::allocator_traits<allocator_type>::propagate_on_container_move_assignment::valueistrue, the allocator of*thisis replaced by a copy of that ofother. If it isfalseand the allocators of*thisandotherdo not compare equal,*thiscannot take ownership of the memory owned byotherand must assign each entries individually, allocating additional memory using its own allocator as needed.
In any case, the stacktrace entries originally belong to *this may be either destroyed or replaced by element-wise assignment.
*this may be set to empty on allocation failure if the implementation strengthens the exception specification.
π Parameters π
otherβ anotherbasic_stacktraceto use as source
π¦ Return value π¦
*this
β¨ Complexity β¨
- Linear in the size of
*thisandother. - Linear in the size of
*thisunless the allocators do not compare equal and do not propagate, in which case linear in the size of*thisandother.
π₯ Exceptions π₯
- May throw implementation-defined exceptions.
noexceptspecification:
noexcept(std::allocator_traits<Allocator>::propagate_on_container_move_assignment::value || std::allocator_traits<Allocator>::is_always_equal::value)
π Notes π
After container move assignment (overload (2)), unless element-wise move assignment is forced by incompatible allocators, 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 π
- constructor β creates a new
basic_stacktrace(public member function)
π Categories π
- conditionally noexcept
- Todo no example
okay thatβs the whole vibe π β source http://cppreference.com, date 2024.06.10, page std::basic_...::operator=(3). mwah π
π¦ 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