Namespaces
Variants

std:: resetiosflags

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
Output flushing
Status flags manipulation
resetiosflags
Time and money I/O
(C++11)
(C++11)
(C++11)
(C++11)
Quoted manipulator
(C++14)
헤더 파일에 정의됨 <iomanip>
/*unspecified*/ resetiosflags ( std:: ios_base :: fmtflags mask ) ;

표현식에서 사용될 때 out << resetiosflags ( mask ) 또는 in >> resetiosflags ( mask ) mask 에 지정된 대로 스트림 out 또는 in 의 모든 형식 플래그를 지웁니다.

목차

매개변수

mask - 지울 플래그들의 비트마스크

반환값

지정되지 않은 타입의 객체로서

  • 만약 out std:: basic_ostream < CharT, Traits > 타입의 객체라면, 표현식 out << resetiosflags ( mask )
    • 타입은 std:: basic_ostream < CharT, Traits > &
    • 값은 out
    • 마치 f ( out, mask ) 을 호출한 것처럼 동작합니다
  • 만약 in std:: basic_istream < CharT, Traits > 타입의 객체라면, 표현식 in >> resetiosflags ( mask )
    • 타입은 std:: basic_istream < CharT, Traits > &
    • 값은 in
    • 마치 f ( in, mask ) 을 호출한 것처럼 동작합니다

함수 f 가 다음과 같이 정의되는 경우:

void f(std::ios_base& str, std::ios_base::fmtflags mask)
{
    // 지정된 플래그 재설정
    str.setf(ios_base::fmtflags(0), mask);
}

예제

#include <iomanip>
#include <iostream>
#include <sstream>
int main()
{
    std::istringstream in("10 010 10 010 10 010");
    int n1, n2;
    in >> std::oct >> n1 >> n2;
    std::cout << "Parsing \"10 010\" with std::oct gives: " << n1 << ' ' << n2 << '\n';
    in >> std::dec >> n1 >> n2;
    std::cout << "Parsing \"10 010\" with std::dec gives: " << n1 << ' ' << n2 << '\n';
    in >> std::resetiosflags(std::ios_base::basefield) >> n1 >> n2;
    std::cout << "Parsing \"10 010\" with autodetect gives: " << n1 << ' ' << n2 << '\n';
}

출력:

Parsing "10 010" with std::oct gives: 8 8
Parsing "10 010" with std::dec gives: 10 10
Parsing "10 010" with autodetect gives: 10 8

결함 보고서

다음의 동작 변경 결함 보고서들은 이전에 발표된 C++ 표준에 소급 적용되었습니다.

DR 적용 대상 게시된 동작 올바른 동작
LWG 183 C++98 resetiosflags
std::ostream 또는 std::istream 타입의 스트림에서만
사용 가능했음
모든 문자 스트림에서
사용 가능

참고 항목

특정 형식 플래그 설정
( std::ios_base 의 public member function)
지정된 ios_base 플래그 설정
(function)