Reputation: 169
I am reading this page: https://software.intel.com/en-us/node/506167 and I am trying to understand how exactly I can use my own swap function?
There are no examples about this available and the documentation is not specific enough. Can someone please provide an example?
Upvotes: 0
Views: 169
Reputation: 61
After Bjarne Stroustrup
template<class T>
void swap(T& a, T& b)
{
T tmp {std::move(a)};
a = std::move(b);
b = std::move(tmp);
}
You pass it like any other. Use just a name. How do you pass a function as a parameter in C?
Upvotes: 1