Namespaces
Variants

std:: basic_format_context

From cppreference.net
헤더에 정의됨 <format>
template < class OutputIt, class CharT >
class basic_format_context ;
(1) (C++20부터)
using format_context = basic_format_context < /* unspecified */ , char > ;
(2) (C++20부터)
using wformat_context = basic_format_context < /* unspecified */ , wchar_t > ;
(3) (C++20부터)

서식 지정 인자와 출력 반복자로 구성된 서식 지정 상태에 대한 접근을 제공합니다.

2) 지정되지 않은 템플릿 인자는 std::string 에 추가하는 출력 반복자이며, 예를 들어 std:: back_insert_iterator < std:: string > 과 같습니다. 구현에서는 일반적으로 모든 연속적이고 크기 조정 가능한 컨테이너에 추가를 지원하는 타입 소거된 버퍼 타입에 대한 반복자를 사용합니다.
3) 지정되지 않은 템플릿 인수는 std::wstring 에 추가하는 출력 반복자입니다.

OutputIt std:: output_iterator < const CharT & > 를 모델로 하지 않는 경우 동작은 정의되지 않습니다.

std::basic_format_context 의 명시적 또는 부분 특수화를 선언하는 프로그램은 진단 없이 잘못된 형식입니다.

std::basic_format_context 객체는 구현체에 의해서만 생성될 수 있습니다. 사용자 코드는 std::formatter 특수화의 format 함수를 통해서만 형식 컨텍스트를 수정할 수 있습니다.

목차

멤버 타입

유형 정의
iterator OutputIt
char_type CharT

멤버 별칭 템플릿

타입 정의
formatter_type < T > std:: formatter < T, CharT >

멤버 함수

(constructor)
[deleted]
basic_format_context 사용자 코드로 생성할 수 없음
(public member function)
operator=
[deleted]
basic_format_context 할당할 수 없음
(public member function)
arg
주어진 인덱스의 인수를 반환함
(public member function)
locale
로케일별 서식 지정에 사용되는 로케일을 반환함
(public member function)
out
출력 버퍼에 대한 반복자를 반환함
(public member function)
advance_to
출력 반복자를 주어진 위치로 진행시킴
(public member function)

std::basic_format_context:: arg

std:: basic_format_arg < basic_format_context > arg ( std:: size_t id ) const ;

args 에서 id 번째 인수를 보유하는 std::basic_format_arg 를 반환합니다. 여기서 args 는 서식 지정 함수에 전달된 매개변수 팩 또는 std::basic_format_args 객체입니다.

id 가 서식 인수의 개수보다 작지 않은 경우, 기본 생성된 std::basic_format_arg ( std::monostate 객체를 보유함)를 반환합니다.

std::basic_format_context:: locale

std:: locale locale ( ) ;

서식 지정 함수에 전달된 locale을 반환합니다. 서식 지정 함수가 locale을 받지 않는 경우 기본 생성된 std::locale 을 반환합니다.

std::basic_format_context:: out

iterator out ( ) ;

출력 버퍼에 대한 반복자를 반환합니다. 결과는 저장된 반복자로부터 이동 생성됩니다.

std::basic_format_context:: advance_to

void advance_to ( iterator it ) ;

저장된 출력 반복자에 it 을 이동 할당합니다. advance_to 호출 후, 다음 out() 호출은 할당 전 it 이 가지고 있던 값을 가진 반복자를 반환합니다.

예제

결함 보고서

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

DR 적용 대상 게시된 동작 수정된 동작
LWG 3567 C++20 basic_format_context 이동 전용 반복자 타입에서 작동하지 않음 반복자 이동이 가능하도록 수정
LWG 3975 C++20 basic_format_context 사용자 특수화가 허용됨 허용되지 않도록 변경
LWG 4061 C++20 basic_format_context 사용자 코드에서 생성 및 할당 가능했음 생성 및 할당 모두 불가능하도록 변경