std::scoped_allocator_adaptor<OuterAlloc,InnerAlloc...>:: construct
|
헤더에 정의됨
<scoped_allocator>
|
||
|
template
<
class
T,
class
...
Args
>
void construct ( T * p, Args && ... args ) ; |
(1) | |
|
template
<
class
T1,
class
T2,
class
...
Args1
,
class
...
Args2
>
void
construct
(
std::
pair
<
T1, T2
>
*
p,
std::
piecewise_construct_t
,
|
(2) | (C++20 이전) |
|
template
<
class
T1,
class
T2
>
void construct ( std:: pair < T1, T2 > * p ) ; |
(3) | (C++20 이전) |
|
template
<
class
T1,
class
T2,
class
U,
class
V
>
void construct ( std:: pair < T1, T2 > * p, U && x, V && y ) ; |
(4) | (C++20 이전) |
|
template
<
class
T1,
class
T2,
class
U,
class
V
>
void construct ( std:: pair < T1, T2 > * p, const std:: pair < U, V > & xy ) ; |
(5) | (C++20까지) |
|
template
<
class
T1,
class
T2,
class
U,
class
V
>
void construct ( std:: pair < T1, T2 > * p, std:: pair < U, V > && xy ) ; |
(6) | (C++20까지) |
|
헬퍼 함수 템플릿
|
||
|
template
<
class
T,
class
...
Args
>
std:: tuple < /* see below */ > /*concat-args*/ ( std:: tuple < Args... > && tup ) ; |
(7) |
(
설명 전용*
)
(C++20 이전) |
할당되었지만 초기화되지 않은 저장 공간을 가리키는 p 에서 외부 할당자와 제공된 생성자 인수를 사용하여 객체를 생성합니다. 객체 자체가 할당자를 사용하는 타입인 경우 , 또는 std::pair 인 경우 (C++20 이전) , 내부 할당자를 생성된 객체에 전달합니다.
T
by
uses-allocator construction
at the uninitialized memory location indicated by
p
using the outermost allocator.
|
std:: uses_allocator < T, inner_allocator_type > :: value 를 uses_inner 로 주어졌을 때:
이 오버로드는
|
(C++20 이전) |
|
다음 코드와 동등합니다:
std::
apply
|
(C++20부터) |
concat-args
<
T1
>
(
std
::
move
(
x
)
)
로,
yprime
을
concat-args
<
T2
>
(
std
::
move
(
y
)
)
로 정의하고,
outermost-construct
(
p,
std::
piecewise_construct
, std
::
move
(
xprime
)
, std
::
move
(
yprime
)
)
를 호출합니다.
std:: forward_as_tuple ( xarg ) , std:: forward_as_tuple ( yarg ) ) ; , 여기서 xarg 와 yarg 는 다음과 같이 정의됩니다:
| 오버로드 | xarg | yarg |
|---|---|---|
| (4) | std:: forward < U > ( x ) | std:: forward < V > ( y ) |
| (5) | xy. first | xy. second |
| (6) | std:: forward < U > ( xy. first ) | std:: forward < V > ( xy. second ) |
- 만약 uses_inner 가 false 이고 std:: is_constructible < T, Args... > :: value 가 true 이면, std:: tuple < Args && ... > ( std :: move ( tup ) ) 를 반환합니다.
-
그렇지 않고 만약
uses_inner
와
std::
is_constructible
<
T,
std::
allocator_arg_t
,
inner_allocator_type & ,
Args... > :: value 가 모두 true 이면, std:: tuple_cat ( std:: tuple < std:: allocator_arg_t , inner_allocator_type & >
( std:: allocator_arg , inner_allocator ( ) ) ,
std:: tuple < Args && ... > ( std :: move ( tup ) ) ) 를 반환합니다. -
그렇지 않고 만약
uses_inner
와
std::
is_constructible
<
T, Args..., inner_allocator_type
&
>
::
value
가 모두
true
이면,
std::
tuple_cat
(
std::
tuple
<
Args
&&
...
>
(
std
::
move
(
tup
)
)
,
std:: tuple < inner_allocator_type & > ( inner_allocator ( ) ) 를 반환합니다. - 그렇지 않으면 프로그램은 ill-formed입니다.
목차 |
매개변수
| p | - | 할당되었지만 초기화되지 않은 저장 공간을 가리키는 포인터 |
| args | - |
T
의 생성자에 전달할 생성자 인수
|
| x | - |
T1
의 생성자에 전달할 생성자 인수
|
| y | - |
T2
의 생성자에 전달할 생성자 인수
|
| xy | - |
두 멤버가 각각
T1
와
T2
의 생성자 인수인 pair
|
| tup | - | 병합될 인수들 |
참고 사항
이 함수는 (
std::allocator_traits
를 통해) 할당자 인식 객체(예:
std::vector
)가 사용할 할당자로
std::scoped_allocator_adaptor
가 주어졌을 때 호출됩니다.
inner_allocator_type
자체가
std::scoped_allocator_adaptor
의 특수화이기 때문에, 이 함수를 통해 생성된 할당자 인식 객체들이 자신의 멤버들을 생성하기 시작할 때에도 이 함수가 호출됩니다.
결함 보고서
다음의 동작 변경 결함 보고서들은 이전에 발표된 C++ 표준에 소급 적용되었습니다.
| DR | 적용 대상 | 게시된 동작 | 올바른 동작 |
|---|---|---|---|
| LWG 2203 | C++11 |
내부 할당자를 값 초기화된
inner_allocator_type
객체로 획득
|
inner_allocator()
호출로 획득
|
|
LWG 2511
( P0475R1 ) |
C++11 |
concat-args
가
std::tuple
의 요소들을 복사할 수 있음
|
모든 요소 복사 연산 제거 |
| LWG 2586 | C++11 |
inner_allocator_type
rvalue로부터의 생성만 검사됨
|
비상수
inner_allocator_type
lvalue로부터의 생성 검사로 대체
|
| LWG 2975 | C++11 | 오버로드 (1) 이 제약되지 않음 | std::pair 를 거부하도록 제약됨 |
참고 항목
|
[static]
|
할당된 저장 공간에 객체를 생성함
(함수 템플릿) |
|
(until C++20)
|
할당된 저장 공간에 객체를 생성함
(
std::allocator<T>
의 public 멤버 함수)
|