MCPcopy Create free account
hub / github.com/Apress/beginning-cpp20 / swap

Method swap

Exercises/NoModules/Chapter 17/Soln17_01/Array.h:98–102  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

96// Swap member function template
97template <typename T>
98void Array<T>::swap(Array& other) noexcept
99{
100 std::swap(m_elements, other.m_elements); // Swap two pointers
101 std::swap(m_size, other.m_size); // Swap the sizes
102}
103
104// Swap non-member function template (optional)
105template <typename T>

Callers 1

swapFunction · 0.45

Calls 1

swapFunction · 0.70

Tested by

no test coverage detected