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

Method swap

Examples/NoModules/Chapter 17/Ex17_02A/Array.h:80–84  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

78// Swap member function template
79template <typename T, int startIndex>
80void Array<T, startIndex>::swap(Array& other) noexcept
81{
82 std::swap(m_elements, other.m_elements); // Swap two pointers
83 std::swap(m_size, other.m_size); // Swap the sizes
84}
85
86// Swap non-member function template (can only swap arrays with identical startIndex)
87template <typename T, int startIndex>

Callers 1

swapFunction · 0.45

Calls 1

swapFunction · 0.70

Tested by

no test coverage detected