I am a bit new with C++ so I was wondering if anyone knew the answer to this. How does one generate a compile time function in C++? i.e. if one wanted for some strange reason to compute the fibonacci sequence at compile time using templates and plug the value into a program how does one go about it? I use to have a book which discussed this and other generative metaprogramming issues but I forget how it's done (and I cannot find the book) :(.
Thanks,
04 Mar, 2009, David Haley wrote in the 2nd comment:
Votes: 0
See e.g. this link (found from "google c++ metaprogramming fibonacci", second link. Interestingly enough, the author is a good friend of mine, we went to college together)
I am a bit new with C++ so I was wondering if anyone knew the answer to this. How does one generate a compile time function in C++? i.e. if one wanted for some strange reason to compute the fibonacci sequence at compile time using templates and plug the value into a program how does one go about it? I use to have a book which discussed this and other generative metaprogramming issues but I forget how it's done (and I cannot find the book) :(.
Thanks,