In general you're looking for something like (C++11):

template <class T> void swap (T& a, T& b)
{
T c(std::move(a)); a=std::move(b); b=std::move(c);
}
template <class T, size_t N> void swap (T &a[N], T &b[N])
{
for (size_t i = 0; i<N; ++i) swap (a[i],b[i]);
}

where T must be copy-constructible and assignable.

This is also what std::swap does for you.

Best regards

Espen Harlinn