/******************************************************************************/ /* */ /* FILE: december.cpp */ /* */ /* Should I call this a misuse of an algorithm or an abuse of a struct ?? */ /* ====================================================================== */ /* */ /* Compiled and tested with Visual C++ V6.0 */ /* */ /* V1.00 28-DEC-2001 P. Tellenbach http://www.heimetli.ch/ */ /* */ /******************************************************************************/ #include <iostream> #include <algorithm> using namespace std ; template< typename T > struct grusel { T t ; T operator()( T x, T y ) { cout << x << y ; return x ; } grusel &operator++() { return *this ; } T &operator*() { return t ; } int operator&() { return 0 ; } } ; typedef grusel<char> GRUSEL ; int main() { string s( "Hlowrd!" ) ; return &transform( s.begin(), s.end(), "el ol \n", GRUSEL(), GRUSEL() ) ; }
Update 31. December 2021
This program compiles and runs without any changes.