I’m new to this whole Template Metaprogramming in C++ mess and I simply can’t get this right.
The scenario:
For example, I’ve got fractions 2/5, 6/9,… I want to calculate the result of those fractions at compile-time and sort them later using that value at run-time.
Is this even possible?
Macros maybe?
Edit:
Thanks Naveen, but it doesn’t answer the question if it’s possible to calculate floats at compile time using templates. Using recursion, for example.
I can’t find any info on the webs :/
Not sure what you are asking. Do you mean something like this:
Edit: If you seriously want to get into template programming, meta or otherwise, I strongly suggest getting hold of the book C++ Templates: The Complete Guide, which is excellent.