Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualBrother Bob

Posted 31 May 2013 - 01:17 PM

You have to keep one thing in mind; sortDescending is not a function, it is a template. A template is a blue-print instructing the compiler how to generate the instance once you instantiate the template, and only an instantiation of the template is actually a function. In other words, sortDescending<int> and sortDescending<double> are both functions that are generated by the compiler from your template, but sortDescending is not a function; it is a template for a function.

 

The sort function takes a function, and thus your template has to be instantiated at the point it is passed to the sort function.


#1Brother Bob

Posted 31 May 2013 - 01:16 PM

You have to keep one thing in mind; sortDescending is not a function, it is a template. A template is a blue-print instructing the compiler how to generate the instance once you instantiate the template, and only a specific instantiation of the preducate template is a function. In other words, sortDescending<int> and sortDescending<double> are both functions that are generated by the compiler from your template, but sortDescending is not a function; it is a template for a function.

 

The sort function takes a function, and thus your template has to be instantiated at the point it is passed to the sort function.


PARTNERS