std::move_only_function:: move_only_function
|
move_only_function
(
)
noexcept
;
|
(1) | (seit C++23) |
|
move_only_function
(
std::
nullptr_t
)
noexcept
;
|
(2) | (seit C++23) |
|
move_only_function
(
move_only_function
&&
other
)
noexcept
;
|
(3) | (seit C++23) |
|
move_only_function
(
const
move_only_function
&
)
=
delete
;
|
(4) | (seit C++23) |
|
template
<
class
F
>
move_only_function ( F && f ) ; |
(5) | (seit C++23) |
|
template
<
class
T,
class
...
CArgs
>
explicit move_only_function ( std:: in_place_type_t < T > , CArgs && ... args ) ; |
(6) | (seit C++23) |
|
template
<
class
T,
class
U,
class
...
CArgs
>
explicit
move_only_function
(
std::
in_place_type_t
<
T
>
,
|
(7) | (seit C++23) |
Erstellt ein neues
std::move_only_function
.
std::move_only_function
.
std::move_only_function
, dessen Ziel das von
other
ist.
other
befindet sich nach der Move-Konstruktion in einem gültigen, aber unspezifizierten Zustand.
VT
gleich
std::
decay_t
<
F
>
. Falls
f
ein null-Funktionszeiger, ein null-Zeiger auf Element oder ein leeres
std::move_only_function
(kann eine beliebige andere Spezialisierung sein) ist, dann wird ein leeres
std::move_only_function
konstruiert. Andernfalls wird ein
std::move_only_function
konstruiert, dessen Ziel vom Typ
VT
ist und direkt-nicht-Listen-initialisiert wird mit
std::
forward
<
F
>
(
f
)
.
-
Diese Überladung nimmt nur dann an der Überladungsauflösung teil, wenn
VTweder gleichmove_only_functionnoch eine Spezialisierung von std::in_place_type_t ist, und /*is-callable-from*/ < VT > (siehe unten) true ist. - Das Programm ist fehlerhaft, wenn std:: is_constructible_v < VT, F > nicht true ist.
VT
definiert als
std::
decay_t
<
T
>
. Konstruiert ein
std::move_only_function
, dessen Zielobjekt vom Typ
VT
ist und direkt-nicht-Listen-initialisiert wird mit
std::
forward
<
CArgs
>
(
args
)
...
.
- Diese Überladung nimmt nur dann an der Überladungsauflösung teil, wenn sowohl std:: is_constructible_v < VT, CArgs... > als auch /*is-callable-from*/ < VT > (siehe unten) true sind.
-
Das Programm ist fehlerhaft, wenn
VTnicht denselben Typ wieThat.
VT
definiert als
std::
decay_t
<
T
>
. Konstruiert ein
std::move_only_function
, dessen Zielobjekt vom Typ
VT
ist und direkt-nicht-List-initialisiert wird mit
il,
std::
forward
<
CArgs
>
(
args
)
...
.
- Diese Überladung nimmt nur dann an der Überladungsauflösung teil, wenn sowohl std:: is_constructible_v < VT, std:: initializer_list < U > & , CArgs... > als auch /*is-callable-from*/ < VT > (siehe unten) true sind.
-
Das Programm ist fehlerhaft, wenn
VTnicht denselben Typ wieThat.
Für Konstruktoren
(5-7)
ist das Verhalten undefiniert, wenn
VT
nicht die
Destructible
-Anforderungen erfüllt, oder wenn
std::
is_move_constructible_v
<
VT
>
true
ist, aber
VT
nicht die
MoveConstructible
-Anforderungen erfüllt.
Die Konstante
/*is-callable-from*/
<
VT
>
hängt von
cv
,
ref
und
noex
im Template-Parameter von
std::move_only_function
wie folgt ab:
| cv ref noexcept ( noex ) | /*aufrufbar-von*/ < VT > |
| noexcept ( false ) |
std::
is_invocable_r_v
<
R, VT, Args...
>
&&
std:: is_invocable_r_v < R, VT & , Args... > |
| noexcept ( true ) |
std::
is_nothrow_invocable_r_v
<
R, VT, Args...
>
&&
std:: is_nothrow_invocable_r_v < R, VT & , Args... > |
| const noexcept ( false ) |
std::
is_invocable_r_v
<
R,
const
VT, Args...
>
&&
std:: is_invocable_r_v < R, const VT & , Args... > |
| const noexcept ( true ) |
std::
is_nothrow_invocable_r_v
<
R,
const
VT, Args...
>
&&
std:: is_nothrow_invocable_r_v < R, const VT & , Args... > |
| & noexcept ( false ) | std:: is_invocable_r_v < R, VT & , Args... > |
| & noexcept ( true ) | std:: is_nothrow_invocable_r_v < R, VT & , Args... > |
| const & noexcept ( false ) | std:: is_invocable_r_v < R, const VT & , Args... > |
| const & noexcept ( true ) | std:: is_nothrow_invocable_r_v < R, const VT & , Args... > |
| && noexcept ( false ) | std:: is_invocable_r_v < R, VT, Args... > |
| && noexcept ( true ) | std:: is_nothrow_invocable_r_v < R, VT, Args... > |
| const && noexcept ( false ) | std:: is_invocable_r_v < R, const VT, Args... > |
| const && noexcept ( true ) | std:: is_nothrow_invocable_r_v < R, const VT, Args... > |
Inhaltsverzeichnis |
Parameter
| other | - |
eine andere
std::move_only_function
zum Verschieben
|
| f | - | eine Funktion oder ein Callable Objekt zum Einhüllen |
| args | - | Argumente zum Konstruieren des Zielobjekts |
| il | - | std::initializer_list zum Konstruieren des Zielobjekts |
Ausnahmen
VT
ein Funktionszeigertyp oder eine Spezialisierung von
std::reference_wrapper
ist.
Beispiel
|
Dieser Abschnitt ist unvollständig
Grund: Kein Beispiel |
Siehe auch
Konstruiert eine neue
std::function
Instanz
(öffentliche Elementfunktion von
std::function<R(Args...)>
)
|
|
Konstruiert ein neues
std::copyable_function
Objekt
(öffentliche Elementfunktion von
std::copyable_function
)
|