출력 스트림 Manipulators 인수가 하나 (예: int 또는 long)

매개 변수가 있는 manipulators를 만들기 위한 일련의 매크로 iostream 클래스 라이브러리를 제공 합니다.Manipulators를 한 번 int 또는 long 인수는 특별 한 경우입니다.하나만 허용은 출력 스트림이 manipulator를 만드는 int 또는 long 인수 (와 같은 setw), <iomanip>에 정의 된 _Smanip 매크로 사용 해야 합니다.다음이 예제 정의 fillblank 는 스트림에 지정된 된 공백 수 삽입 manipulator:

예제

// output_stream_manip.cpp
// compile with: /GR /EHsc
#include <iostream>
#include <iomanip>
using namespace std;

void fb( ios_base& os, int l )
{
   ostream *pos = dynamic_cast<ostream*>(&os);
   if (pos)
   {
      for( int i=0; i < l; i++ )
      (*pos) << ' ';
   };
}

_Smanip<int>
   __cdecl fillblank(int no)
   {   
   return (_Smanip<int>(&fb, no));
   }

int main( )
{
   cout << "10 blanks follow" << fillblank( 10 ) << ".\n";
}

참고 항목

참조

사용자 지정 Manipulators 인수