std::swap(std::array)_C++中文网

template< class T, std::size_t N >

void swap( array<T,N>& lhs,

           array<T,N>& rhs );

(C++11 起)
(C++17 前)

template< class T, std::size_t N >

void swap( array<T,N>& lhs,

           array<T,N>& rhs ) noexcept(/* see below */);

(C++17 起)
(C++20 前)

template< class T, std::size_t N >

constexpr void swap( array<T,N>& lhs,

                     array<T,N>& rhs ) noexcept(/* see below */);

(C++20 起)

std::array 特化 std::swap 算法。交换 lhsrhs 的内容。调用 lhs.swap(rhs)

参数

返回值

(无)

复杂度

与容器大小成线性。

异常

noexcept

规定:  

noexcept(noexcept(lhs.swap(rhs)))

(C++17 起)

参阅