>Okay, while continuing to search, I came up with this:
>http://msdn.microsoft.com/en-us/libr...=VS.80%29.aspx
_Smanip is a Microsoft-ism. Don't expect code using it to compile anywhere except Visual C++. The concept behind _Smanip is trivial anyway:
#include <iostream>
#include <iomanip>
struct fillblank {
int _l;
fillblank ( int l ): _l ( l ) {}
friend std::ostream& operator<< ( std::ostream& os, fillblank fb )
{
for ( int i = 0; i < fb._l; i++ )
os << ' ';
return os;
}
};
int main()
{
std::cout << "10 blanks follow" << fillblank ( 10 ) << ".\n";
}
The arguments are actually constructor arguments, which are then stored as data members in a temporary object and an overloaded << operator is called on the stream using that temporary object. It's elegant and works very well.