GLProgramming.com

home :: about :: development guides :: irc :: forums :: search :: paste :: links :: contribute :: code dump

-> Click here to learn how to get live help <-


New Paste :: Recent Pastes:: Add Line Numbers


fact meta-prog by CraZyLeGs
template<unsigned int N> struct Fact
{
    enum {Value = N * Fact<N - 1>::Value};
};
template<> struct Fact<0>
{
    enum {Value = 1};
};

// x would be 24 before you even launch the program - no overhead
unsigned int x = Fact<4>::Value;