std::indirect<T, Allocator>:: indirect
|
constexpr
explicit
indirect
(
)
;
|
(1) | (seit C++26) |
|
constexpr
explicit
indirect
(
std::
allocator_arg_t
,
const
Allocator
&
a
)
;
|
(2) | (seit C++26) |
|
template
<
class
U
=
T
>
constexpr explicit indirect ( U && v ) ; |
(3) | (seit C++26) |
|
template
<
class
U
=
T
>
constexpr
explicit
indirect
(
std::
allocator_arg_t
,
const
Allocator
&
a,
|
(4) | (seit C++26) |
|
template
<
class
...
Args
>
constexpr explicit indirect ( std:: in_place_t , Args && ... args ) ; |
(5) | (seit C++26) |
|
template
<
class
...
Args
>
constexpr
explicit
indirect
(
std::
allocator_arg_t
,
const
Allocator
&
a,
|
(6) | (seit C++26) |
|
template
<
class
I,
class
...
Args
>
constexpr
explicit
indirect
(
std::
in_place_t
,
std::
initializer_list
<
I
>
ilist,
|
(7) | (seit C++26) |
|
template
<
class
I,
class
...
Args
>
constexpr
explicit
indirect
(
std::
allocator_arg_t
,
const
Allocator
&
a,
|
(8) | (seit C++26) |
|
constexpr
indirect
(
const
indirect
&
other
)
;
|
(9) | (seit C++26) |
|
constexpr
indirect
(
std::
allocator_arg_t
,
const
Allocator
&
a,
const indirect & other ) ; |
(10) | (seit C++26) |
|
constexpr
indirect
(
indirect
&&
other
)
noexcept
;
|
(11) | (seit C++26) |
|
constexpr
indirect
(
std::
allocator_arg_t
,
const
Allocator
&
a,
indirect && other ) noexcept ( /* siehe unten */ ) ; |
(12) | (seit C++26) |
Konstruiert ein neues
indirect
Objekt.
Inhaltsverzeichnis |
Parameter
| a | - | der Allokator, der zugeordnet werden soll |
| v | - | Wert, mit dem der enthaltene Wert initialisiert wird |
| args | - | Argumente, mit denen der enthaltene Wert initialisiert wird |
| il | - | Initialisierungsliste, mit der der enthaltene Wert initialisiert wird |
| other | - |
ein anderes
indirect
-Objekt, dessen enthaltene Wert (falls vorhanden) kopiert wird
|
Effekte
Die Konstruktion eines neuen
indirect
Objekts besteht aus den folgenden Schritten:
alloc
:
-
Wenn der Initialisierer für
allocleer ist, wird er wertinitialisiert . -
Wenn der Initialisierer für
allocnicht leer ist, wird er direkt-nicht-Listen-initialisiert mit dem Initialisiererargument.
-
Für Überladungen
(
1-8
)
, initialisiere
pmit dem Ergebnis des Aufrufs von std:: allocator_traits < Allocator > :: allocate , dann rufe std:: allocator_traits < Allocator > :: construct (alloc ,p , args... ) , wobei args... ein Ausdruckspaket mit den Initialisierungsargumenten ist. -
Für Überladungen
(
9-12
)
:
- Wenn other wertlos ist, wird kein verwaltetes Objekt konstruiert, und * this ist nach der Konstruktion ebenfalls wertlos.
-
Andernfalls, wenn
other
ein Rvalue-Referenz ist und
allocgleich other.allocist, * this übernimmt das Eigentum am verwalteten Objekt von other . -
Andernfalls wird das verwaltete Objekt unter Verwendung von
allocwie oben beschrieben konstruiert.
| Überladung | Initialisierer für... |
valueless_after_move()
nach Konstruktion |
|
|---|---|---|---|
alloc
|
das verwaltete Objekt | ||
| ( 1 ) | (leer) | (leer) | false |
| ( 2 ) | a | ||
| ( 3 ) | (leer) | std:: forward < U > ( v ) | |
| ( 4 ) | a | ||
| ( 5 ) | (leer) | std:: forward < Args > ( args ) | |
| ( 6 ) | a | ||
| ( 7 ) | (leer) | ilist, std:: forward < Args > ( args ) | |
| ( 8 ) | a | ||
| ( 9 ) | siehe unten |
*
other
(nur wenn other einen Wert besitzt) |
true nur wenn other wertlos ist |
| ( 10 ) | a | ||
| ( 11 ) |
std
::
move
(
other.
alloc
)
|
übernimmt Besitz
(nur wenn other einen Wert besitzt) |
|
| ( 12 ) | a | siehe unten | |
alloc
wird direkt-nicht-Listen-initialisiert mit
std::
allocator_traits
<
Allocator
>
::
select_on_container_copy_construction
(
other.
alloc
)
.
Einschränkungen und ergänzende Informationen
U
Args...
- std:: is_same_v < std:: remove_cvref_t < U > , std :: indirect >
- std:: is_same_v < std:: remove_cvref_t < U > , std:: in_place_t >
false
ist und
T
ein
unvollständiger Typ
ist, ist das Programm fehlerhaft.
Exceptions
Wirft nichts, es sei denn std:: allocator_traits < Allocator > :: allocate oder std:: allocator_traits < Allocator > :: construct werfen.
Beispiel
|
Dieser Abschnitt ist unvollständig
Grund: Kein Beispiel |
Siehe auch
|
(C++11)
|
Tag-Typ zur Auswahl von allocator-aware Konstruktorüberladungen
(Klasse) |
|
In-place-Konstruktions-Tag
(Tag) |