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
From 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)
포함된 객체가 제자리에서 생성되어야 함을 나타내기 위해 생성자에 전달할 수 있는 명확화 태그이며, (후자 두 개의 경우) 생성될 객체의 타입을 나타냅니다.
표준 라이브러리
다음 표준 라이브러리 타입들은 (1-6) 을 모호성 제거 태그로 사용합니다:
|
(C++17)
|
모든
CopyConstructible
타입의 인스턴스를 보유하는 객체
(클래스) |
|
(C++23)
|
기대값 또는 오류 값을 포함하는 래퍼
(클래스 템플릿) |
|
(C++23)
|
주어진 호출 시그니처에서 한정자를 지원하는 모든 호출 가능 객체의 이동 전용 래퍼
(클래스 템플릿) |
|
(C++17)
|
객체를 보유할 수도 있고 보유하지 않을 수도 있는 래퍼
(클래스 템플릿) |
|
(C++17)
|
타입 안전 식별 공용체
(클래스 템플릿) |
참고 항목
|
(C++23)
|
범위의 요소들이 정렬되어 있고 고유함을 나타냄
(태그) |
|
범위의 요소들이 정렬되어 있음을 나타냄 (고유성은 요구되지 않음)
(태그) |