std::polymorphic<T, Allocator>:: polymorphic
|
constexpr
explicit
polymorphic
(
)
;
|
(1) | (C++26부터) |
|
constexpr
explicit
polymorphic
(
std::
allocator_arg_t
,
const
Allocator
&
a
)
;
|
(2) | (C++26부터) |
|
template
<
class
U
=
T
>
constexpr explicit polymorphic ( U && v ) ; |
(3) | (C++26부터) |
|
template
<
class
U
=
T
>
constexpr
explicit
polymorphic
(
std::
allocator_arg_t
,
const
Allocator
&
a,
|
(4) | (C++26부터) |
|
template
<
class
U,
class
...
Args
>
constexpr explicit polymorphic ( std:: in_place_type_t < U > , Args && ... args ) ; |
(5) | (C++26부터) |
|
template
<
class
U,
class
...
Args
>
constexpr
explicit
polymorphic
(
std::
allocator_arg_t
,
const
Allocator
&
a,
|
(6) | (C++26부터) |
|
template
<
class
U,
class
I,
class
...
Args
>
constexpr
explicit
polymorphic
(
std::
in_place_type_t
<
U
>
,
|
(7) | (C++26부터) |
|
template
<
class
U,
class
I,
class
...
Args
>
constexpr
explicit
polymorphic
(
std::
allocator_arg_t
,
const
Allocator
&
a,
|
(8) | (C++26부터) |
|
constexpr
polymorphic
(
const
polymorphic
&
other
)
;
|
(9) | (C++26부터) |
|
constexpr
polymorphic
(
std::
allocator_arg_t
,
const
Allocator
&
a,
const polymorphic & other ) ; |
(10) | (C++26부터) |
|
constexpr
polymorphic
(
polymorphic
&&
other
)
noexcept
;
|
(11) | (C++26부터) |
|
constexpr
polymorphic
(
std::
allocator_arg_t
,
const
Allocator
&
a,
polymorphic && other ) noexcept ( /* 아래 참조 */ ) ; |
(12) | (C++26부터) |
새로운
polymorphic
객체를 생성합니다.
목차 |
매개변수
| a | - | 연결될 할당자 |
| v | - | 소유한 값을 초기화할 값 |
| args | - | 소유한 값을 초기화할 인수들 |
| il | - | 소유한 값을 초기화할 초기화자 리스트 |
| other | - |
소유한 값(존재하는 경우)이 복사될 다른
polymorphic
객체
|
효과
새로운
polymorphic
객체의 생성은 다음 단계들로 구성됩니다:
alloc
를 생성합니다:
-
alloc에 대한 초기화자가 비어 있는 경우, 값 초기화(value-initialized) 됩니다. -
alloc에 대한 초기화자가 비어 있지 않은 경우, 초기화자 인수로 직접 비목록 초기화(direct-non-list-initialized) 됩니다.
-
오버로드
(
1-8
)
의 경우,
std::
allocator_traits
<
Allocator
>
::
construct
(
alloc ,p, args... ) 를 호출합니다. 여기서-
p
는
U*타입의 포인터로, 생성될 소유 객체를 위한 저장 공간을 가리키며, - args... 는 초기화 인수를 포함하는 표현식 팩입니다.
-
p
는
- 오버로드 ( 9-12 ) 의 경우:
| 오버로드 | 초기화 대상... | 소유 객체의 타입 |
valueless_after_move()
생성 후 |
|
|---|---|---|---|---|
alloc
|
소유 객체 | |||
| ( 1 ) | (비어 있음) | (비어 있음) |
T
|
false |
| ( 2 ) | a | |||
| ( 3 ) | (비어 있음) | std:: forward < U > ( v ) |
U
|
|
| ( 4 ) | a | |||
| ( 5 ) | (비어 있음) | std:: forward < Args > ( args ) | ||
| ( 6 ) | a | |||
| ( 7 ) | (비어 있음) |
ilist,
std:: forward < Args > ( args ) |
||
| ( 8 ) | a | |||
| ( 9 ) | 아래 참조 |
*
other
( other 가 값을 소유하는 경우에만) |
other 가 소유한 객체의 타입 | true ( other 가 valueless인 경우에만) |
| ( 10 ) | a | |||
| ( 11 ) |
std
::
move
(
other.
alloc
)
|
소유권 이전
( other 가 값을 소유하는 경우에만) |
||
| ( 12 ) | a | 아래 참조 | ||
alloc
는
std::
allocator_traits
<
Allocator
>
::
select_on_container_copy_construction
(
other.
alloc
)
로 직접-비목록-초기화됩니다.
제약 조건 및 보충 정보
- std:: derived_from < std:: remove_cvref_t < U > , T >
- std:: is_copy_constructible_v < std:: remove_cvref_t < U >>
- std:: is_constructible_v < std:: remove_cvref_t < U > , /* argument types */ > , 여기서 /* argument types */ 는:
U
Args...
- std:: is_same_v < std:: remove_cvref_t < U > , std :: polymorphic > 가 false 인 경우.
-
U가 std::in_place_type_t 의 특수화가 아닌 경우.
예외
std:: allocator_traits < Allocator > :: allocate 또는 std:: allocator_traits < Allocator > :: construct 가 예외를 던지지 않는 한 아무것도 던지지 않습니다.
예제
|
이 섹션은 불완전합니다
이유: 예제가 없음 |
참고 항목
|
(C++11)
|
할당자 인식 생성자 오버로드를 선택하는 데 사용되는 태그 타입
(클래스) |
|
인플레이스 생성 태그
(태그) |