Namespaces
Variants

std:: swap (std::polymorphic)

From cppreference.net
Memory management library
( exposition only* )
Allocators
Uninitialized memory algorithms
Constrained uninitialized memory algorithms
Memory resources
Uninitialized storage (until C++20)
( until C++20* )
( until C++20* )
( until C++20* )

Garbage collector support (until C++23)
(C++11) (until C++23)
(C++11) (until C++23)
(C++11) (until C++23)
(C++11) (until C++23)
(C++11) (until C++23)
(C++11) (until C++23)
Defined in header <memory>
constexpr void swap ( polymorphic & lhs, polymorphic & rhs )
noexcept ( noexcept ( lhs. swap ( rhs ) ) ) ;
(since C++26)

Overloads the std::swap algorithm for std::polymorphic . Exchanges the state of lhs with that of rhs . Effectively calls lhs. swap ( rhs ) .

Parameters

lhs, rhs - polymorphic objects whose states to swap

Example

See also

exchanges the contents
(public member function)