04 Mar, 2009, Silenus wrote in the 1st comment:
Votes: 0

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) :(.

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)
04 Mar, 2009, Silenus wrote in the 3rd comment:
Votes: 0
Thanks David. I managed to actually find the answer on wiki a bit after I posted this.