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

Method swap

Examples/NoModules/Chapter 18/Ex18_06/Array.h:122–126  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

120// Swap member function template
121template <typename T>
122void Array<T>::swap(Array& other) noexcept
123{
124 std::swap(m_elements, other.m_elements); // Swap two pointers
125 std::swap(m_size, other.m_size); // Swap the sizes
126}
127
128// Swap non-member function template (optional)
129template <typename T>

Callers 1

swapFunction · 0.45

Calls 1

swapFunction · 0.70

Tested by

no test coverage detected