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

Method swap

Examples/NoModules/Chapter 18/Ex18_04/Array.h:103–107  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

101// Swap member function template
102template <typename T>
103void Array<T>::swap(Array& other) noexcept
104{
105 std::swap(m_elements, other.m_elements); // Swap two pointers
106 std::swap(m_size, other.m_size); // Swap the sizes
107}
108
109// Swap non-member function template (optional)
110template <typename T>

Callers 2

swapFunction · 0.45
mainFunction · 0.45

Calls 1

swapFunction · 0.70

Tested by

no test coverage detected