0

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?

SuperHeroY
  • 169
  • 1
  • 5

1 Answers1

1

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?

Community
  • 1
  • 1
Morlacke
  • 61
  • 6
  • Thanks for the reply, where do I put this? – SuperHeroY Sep 23 '15 at 07:10
  • This is really basic syntax. You really need to read tutorial about basic usage. http://stackoverflow.com/questions/9410/how-do-you-pass-a-function-as-a-parameter-in-c – Morlacke Sep 23 '15 at 07:57