2000

Grusel++ of the month

Home
Download Source
/******************************************************************************/
/*                                                                            */
/*                                                              FILE: MAY.CPP */
/*                                                                            */
/*  Did you know that C++ even supports compile time recursion ?              */
/*  ============================================================              */
/*                                                                            */
/*  Compiled and tested with Visual C++ V6.0                                  */
/*                                                                            */
/*  V1.00   31-MAY-2000   P. Tellenbach   http://www.heimetli.ch/             */
/*                                                                            */
/******************************************************************************/

#include <iostream.h>

template<const int n>
class Count
{
 public:
   static inline print()
   {
      n > 0 && Count< n - 1 >::print() ;

      cout << n << " " ;

      return n ;
   }
} ;

int main( )
{
 return Count< 5 >::print() ;
}