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

Method swap

Exercises/NoModules/Chapter 21/Soln21_06/Array.h:135–139  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

133// Swap member function template
134template <typename T>
135void Array<T>::swap(Array& other) noexcept
136{
137 std::swap(m_elements, other.m_elements); // Swap two pointers
138 std::swap(m_size, other.m_size); // Swap the sizes
139}
140
141// Swap non-member function template (optional)
142template <typename T>

Callers 1

swapFunction · 0.45

Calls 1

swapFunction · 0.70

Tested by

no test coverage detected