2000

Grusel++ of the month

Home
Download Source
/******************************************************************************/
/*                                                                            */
/*                                                         FILE: december.cpp */
/*                                                                            */
/*  Slowly, I begin to appreciate the STL                                     */
/*  =====================================                                     */
/*                                                                            */
/*  Compiled and tested with Visual C++ V6.0                                  */
/*                                                                            */
/*  V1.00   19-DEC-2000   P. Tellenbach   http://www.heimetli.ch/             */
/*                                                                            */
/******************************************************************************/

#include <iostream>
#include <algorithm>

class Process
{
 public:
   operator()( char ch )
   {
      std::cout.put( ch ) ;
   }

   operator int()
   {
      return 0 ;
   }
} ;

int main()
{
   char *ps = "Hello world !\n" ;

   return std::for_each( ps, std::find(ps,(char *)0,'\0'), Process() ) ;
}