Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


#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