| 82 | // Swap member function template |
| 83 | template <typename T> |
| 84 | void Array<T>::swap(Array& other) noexcept |
| 85 | { |
| 86 | std::swap(m_elements, other.m_elements); // Swap two pointers |
| 87 | std::swap(m_size, other.m_size); // Swap the sizes |
| 88 | } |
| 89 | |
| 90 | // Swap non-member function template (optional) |
| 91 | template <typename T> |