Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::basic_stacktrace<Allocator>::operator=

      From cppreference.com
      <cpp‎ |utility‎ |basic stacktrace
       
       
      Diagnostics library
       
       
      basic_stacktrace& operator=(const basic_stacktrace& other);
      (1)(since C++23)
      basic_stacktrace& operator=( basic_stacktrace&& other)
         noexcept(/* see below */);
      (2)(since C++23)

      Replaces the contents of thebasic_stacktrace.

      1) Copy assignment operator. Replaces the contents with a copy of the contents ofother.
      Ifstd::allocator_traits<allocator_type>::propagate_on_container_copy_assignment::value istrue, the allocator of*this is replaced by a copy of that ofother. If the allocator of*this after 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*this may be reused when possible.
      2) Move assignment operator. Replaces the contents with those ofother using move semantics (i.e. the data inother is moved fromother into*this).other is in a valid but unspecified state afterwards.
      Ifstd::allocator_traits<allocator_type>::propagate_on_container_move_assignment::value istrue, the allocator of*this is replaced by a copy of that ofother. If it isfalse and the allocators of*this andother do not compare equal,*this cannot take ownership of the memory owned byother and 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.

      Contents

      [edit]Parameters

      other - anotherbasic_stacktrace to use as source

      [edit]Return value

      *this

      [edit]Complexity

      1) Linear in the size of*this andother.
      2) Linear in the size of*this unless the allocators do not compare equal and do not propagate, in which case linear in the size of*this andother.

      [edit]Exceptions

      1) May throw implementation-defined exceptions.
      2)
      noexcept specification:  
      noexcept(std::allocator_traits<Allocator>::propagate_on_container_move_assignment::value
      ||std::allocator_traits<Allocator>::is_always_equal::value)

      [edit]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) toother 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 viaLWG issue 2321.

      [edit]Example

      This section is incomplete
      Reason: no example

      [edit]See also

      creates a newbasic_stacktrace
      (public member function)[edit]
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/utility/basic_stacktrace/operator%3D&oldid=182760"

      [8]ページ先頭

      ©2009-2025 Movatter.jp