Namespaces
Variants

std:: skipws, std:: noskipws

From cppreference.net
< cpp ‎ | io ‎ | manip
Input/output manipulators
Floating-point formatting
Integer formatting
Boolean formatting
Field width and fill control
Other formatting
Whitespace processing
skipws noskipws
Output flushing
Status flags manipulation
Time and money I/O
(C++11)
(C++11)
(C++11)
(C++11)
Quoted manipulator
(C++14)
헤더 파일에 정의됨 <ios>
(1)
std:: ios_base & noskipws ( std:: ios_base & str ) ;
(2)

형식화된 입력 함수에 의한 선행 공백 건너뛰기를 활성화하거나 비활성화합니다(기본적으로 활성화됨). 출력에는 영향을 주지 않습니다.

1) 스트림 str 에서 skipws 플래그를 활성화합니다. 마치 str. setf ( std:: ios_base :: skipws ) 를 호출한 것처럼 동작합니다.
2) 스트림 str 에서 skipws 플래그를 비활성화합니다. 마치 str. unsetf ( std:: ios_base :: skipws ) 를 호출하는 것처럼 동작합니다.

공백 건너뛰기는 std::basic_istream::sentry 의 생성자에 의해 수행되며, 이는 스트림에 임뷰드된 로캘의 std::ctype 패싯에 의해 공백으로 분류된 문자들을 읽고 버립니다.

이것은 I/O 조정자이며, 다음과 같은 표현식으로 호출될 수 있습니다: out << std :: noskipws std::basic_ostream 타입의 모든 out 에 대해, 또는 다음과 같은 표현식으로 호출될 수 있습니다: in >> std :: noskipws std::basic_istream 타입의 모든 in 에 대해.

목차

매개변수

str - I/O 스트림에 대한 참조

반환값

str (조작 후 스트림에 대한 참조).

예제

#include <iostream>
#include <sstream>
int main()
{
    char c1, c2, c3;
    std::istringstream("a b c") >> c1 >> c2 >> c3;
    std::cout << "Default  behavior:"
                 " c1 = " << c1 << 
                 " c2 = " << c2 << 
                 " c3 = " << c3 << '\n';
    std::istringstream("a b c") >> std::noskipws >> c1 >> c2 >> c3;
    std::cout << "noskipws behavior:" 
                 " c1 = " << c1 <<
                 " c2 = " << c2 <<
                 " c3 = " << c3 << '\n';
}

출력:

Default  behavior: c1 = a c2 = b c3 = c
noskipws behavior: c1 = a c2 =   c3 = b

참고 항목

지정된 ios_base 플래그를 지움
(함수)
지정된 ios_base 플래그를 설정함
(함수)
공백 문자를 소비함
(함수 템플릿)