Skip to content

Search topics & cppreference

Search all study topics, concept maps, and 6,587 C++ and C reference pages.

swap(std::copyable_function)

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

Utility
  • C++11
  • C++23
  • C++26
1 min readView on cppreference
NotebookLM
friend void swap( std::copyable_function& lhs, std::copyable_function& rhs ) noexcept;
(since C++26)

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

This function is not visible to ordinary unqualified or qualified lookup, and can only be found by argument-dependent lookup when std::copyable_function<FunctionType> is an associated class of the arguments.

Parameters

lhs, rhs - std::copyable_function objects whose states to swap

Return value

(none)

Example

This section is incomplete
Reason: no example

See also

swaps the targets of two std::copyable_function objects
(public member function)
specializes the std::swap algorithm
(function template)
specializes the std::swap algorithm
(function)

Content from this page on cppreference.com, licensed under CC-BY-SA 3.0 and GFDL. Modified: restyled, site navigation removed, code windows added. Offline snapshot of 9 February 2025.