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

Method swap

Examples/NoModules/Chapter 18/Ex18_05B/Array.h:113–117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

111// Swap member function template
112template <typename T>
113void Array<T>::swap(Array& other) noexcept
114{
115 std::swap(m_elements, other.m_elements); // Swap two pointers
116 std::swap(m_size, other.m_size); // Swap the sizes
117}
118
119// Swap non-member function template (optional)
120template <typename T>

Callers 1

swapFunction · 0.45

Calls 1

swapFunction · 0.70

Tested by

no test coverage detected