std::swap(std::array) (3) - Linux Manuals

std::swap(std::array): std::swap(std::array)

NAME

std::swap(std::array) - std::swap(std::array)

Synopsis


template< class T, std::size_t N > (since C++11)
void swap( array<T,N>& lhs, (until C++17)
array<T,N>& rhs );
template< class T, std::size_t N > (since C++17)
void swap( array<T,N>& lhs, (until C++20)
array<T,N>& rhs ) noexcept(/* see below */);
template< class T, std::size_t N >
constexpr void swap( array<T,N>& lhs, (since C++20)
array<T,N>& rhs ) noexcept(/* see below */);


Specializes the std::swap algorithm for std::array. Swaps the contents of lhs and rhs. Calls lhs.swap(rhs).


This overload only participates in overload resolution if N == 0 or std::is_swappable<T>::value is true. (since C++17)

Parameters


lhs, rhs - containers whose contents to swap

Return value


(none)

Complexity


Linear in size of the container.

Exceptions


noexcept specification: (since C++17)
noexcept(noexcept(lhs.swap(rhs)))

See also


     swaps the contents
swap (public member function)