Custom Manipulator für Klasse
Ich versuche einen Streammanipulator mit Argumenten zu schreiben. Ich habe Unterricht mit 3 int's CDate (Jahr, Monat, Tag). Also muss ich @ manipulator machdate_format(const char*)
. z.B. :
CDate a(2006, 5, 15);
cout <<"DATE IS : " << date_format("%Y-hello-%d-world-%m-something-%d%d") << a;
Output wird sein:
DATE IS : 2006-hello-15-world-5-something-1515
Guess ich brauche das
ios_base & dummy_date_format_manipulator ( ios_base & x )
{
return x;
}
ios_base & ( * ( date_format ( const char * fmt ) ) )( ios_base & x )
{
return dummy_date_format_manipulator;
}
aber ich weiß nicht wie.