std::in_place, std::in_place_type, std::in_place_index, std::in_place_t, std::in_place_type_t, std::in_place_index_t
cppreference.net에서 발췌
| 헤더 <utility>
|
||
struct in_place_t { explicit in_place_t() = default; };
|
에 정의됨 (1) | (C++17부터) |
inline constexpr std::in_place_t in_place {};
|
(2) | (C++17부터) |
template< class T >
struct in_place_type_t { explicit in_place_type_t() = default; };
|
(3) | (C++17부터) |
template< class T >
constexpr std::in_place_type_t<T> in_place_type {};
|
(4) | (C++17부터) |
template< std::size_t I >
struct in_place_index_t { explicit in_place_index_t() = default; };
|
(5) | (C++17부터) |
template< std::size_t I >
constexpr std::in_place_index_t<I> in_place_index {};
|
(6) | (C++17부터) |
1,3,5) 타입/타입 템플릿
std::in_place_t, std::in_place_type_t 및 std::in_place_index_t은 생성자의 매개변수 목록에서 해당 태그를 일치시키는 데 사용될 수 있습니다.2,4,6) 해당
std::in_place, std::in_place_type, std::in_place_index 인스턴스 (1,3,5)은 생성자에 전달되어 포함된 객체가 제자리(in-place)에서 생성되어야 함을 나타내고, (마지막 두 개의 경우) 생성할 객체의 타입을 나타내는 명확성 태그(disambiguation tags)입니다.표준 라이브러리
다음 표준 라이브러리 타입들은 (1-6) 을 모호성 제거 태그로 사용합니다:
|
(C++17)
|
모든
CopyConstructible
타입의 인스턴스를 보유하는 객체
(클래스) |
|
(C++23)
|
기대값 또는 오류 값을 포함하는 래퍼
(클래스 템플릿) |
|
(C++23)
|
주어진 호출 시그니처에서 한정자를 지원하는 모든 호출 가능 객체의 이동 전용 래퍼
(클래스 템플릿) |
|
(C++17)
|
객체를 보유할 수도 있고 보유하지 않을 수도 있는 래퍼
(클래스 템플릿) |
|
(C++17)
|
타입 안전 식별 공용체
(클래스 템플릿) |
참고 항목
|
(C++23)
|
범위의 요소들이 정렬되어 있고 고유함을 나타냄
(태그) |
|
범위의 요소들이 정렬되어 있음을 나타냄 (고유성은 요구되지 않음)
(태그) |