std::experimental::function<R(Args...)>:: function
|
function
(
)
noexcept
;
|
(1) | (Library Fundamentals TS) |
|
function
(
std::
nullptr_t
)
noexcept
;
|
(2) | (Library Fundamentals TS) |
|
function
(
const
function
&
other
)
;
|
(3) | (Library Fundamentals TS) |
|
function
(
function
&&
other
)
;
|
(4) | (Library Fundamentals TS) |
|
template
<
class
F
>
function ( F f ) ; |
(5) | (Library Fundamentals TS) |
| (6) | ||
|
template
<
class
Alloc
>
function ( std:: allocator_arg_t , const Alloc & alloc ) noexcept ; |
(Bibliotheksfundamente TS) | |
|
function
(
std::
allocator_arg_t
,
const allocator_type & alloc ) noexcept ; |
(Bibliotheksfundamente TS v3) | |
| (7) | ||
|
template
<
class
Alloc
>
function
(
std::
allocator_arg_t
,
const
Alloc
&
alloc,
|
(Library Fundamentals TS) | |
|
function
(
std::
allocator_arg_t
,
const
allocator_type
&
alloc,
std:: nullptr_t ) noexcept ; |
(Library Fundamentals TS v3) | |
| (8) | ||
|
template
<
class
Alloc
>
function
(
std::
allocator_arg_t
,
const
Alloc
&
alloc,
|
(Bibliothek Fundamentals TS) | |
|
function
(
std::
allocator_arg_t
,
const
allocator_type
&
alloc,
const function & other ) ; |
(Bibliothek Fundamentals TS v3) | |
| (9) | ||
|
template
<
class
Alloc
>
function
(
std::
allocator_arg_t
,
const
Alloc
&
alloc,
|
(Library Fundamentals TS) | |
|
function
(
std::
allocator_arg_t
,
const
allocator_type
&
alloc,
function && other ) ; |
(Library Fundamentals TS v3) | |
| (10) | ||
|
template
<
class
F,
class
Alloc
>
function ( std:: allocator_arg_t , const Alloc & alloc, F f ) ; |
(Bibliotheks-Fundamentals TS) | |
|
function
(
std::
allocator_arg_t
,
const
allocator_type
&
alloc, F f
)
;
|
(Bibliotheks-Fundamentals TS v3) | |
Konstruiert ein
std::experimental::function
aus verschiedenen Quellen.
Args...
und den Rückgabetyp
R
.
function
verwenden könnte.
Diese Konstruktoren behandeln
alloc
als einen typgelöschten Allokator (siehe unten).
(bis Library Fundamentals TS v3)
|
Nach der Konstruktion über (1-5) gibt this - > get_memory_resource ( ) denselben Wert zurück wie std:: experimental :: pmr :: get_default_resource ( ) während der Konstruktion. |
(library fundamentals TS)
(bis library fundamentals TS v3) |
|
Nach der Konstruktion über (1-3) und (5) speichert * this einen standardkonstruierten std:: pmr :: polymorphic_allocator <> . |
(library fundamentals TS v3) |
Wenn das target ein Funktionszeiger oder ein std::reference_wrapper ist, ist die Small-Object-Optimierung garantiert, das heißt, diese Targets werden immer direkt innerhalb des std::experimental::function -Objekts gespeichert, es findet keine dynamische Speicherallokation statt. Andere große Objekte können im dynamisch allokierten Speicher konstruiert werden und werden durch das std::experimental::function -Objekt über einen Zeiger angesprochen.
Wenn ein Konstruktor ein Funktionsobjekt verschiebt oder kopiert, einschließlich einer Instanz von
std::experimental::function
, dann wird diese Verschiebung oder Kopie durchgeführt mittels
using-allocator construction
mit Allokator
this
-
>
get_memory_resource
(
)
(bis Library Fundamentals TS v3)
this
-
>
get_allocator
(
)
(Library Fundamentals TS v3)
.
Inhaltsverzeichnis |
Typgelöschter Allokator
Die Konstruktoren von
function
, die ein Allokator-Argument
alloc
annehmen, behandeln dieses Argument als einen typgelöschten Allokator. Der vom
function
zur Speicherallokation verwendete Zeiger auf die Speicherressource wird unter Verwendung des Allokator-Arguments (falls angegeben) wie folgt bestimmt:
Typ von
alloc
|
Wert des Memory-Resource-Zeigers |
| Nicht vorhanden (kein Allokator bei Konstruktion angegeben) | Der Wert von std:: experimental :: pmr :: get_default_resource ( ) zum Zeitpunkt der Konstruktion. |
| std::nullptr_t | Der Wert von std:: experimental :: pmr :: get_default_resource ( ) zum Zeitpunkt der Konstruktion. |
|
Ein Zeigertyp konvertierbar zu
std:: experimental :: pmr :: memory_resource * |
static_cast < std:: experimental :: pmr :: memory_resource * > ( alloc ) |
|
Eine Spezialisierung von
std::experimental::pmr::polymorphic_allocator |
alloc. resource ( ) |
| Jeder andere Typ, der die Allocator Anforderungen erfüllt |
Ein Zeiger auf einen Wert vom Typ
std::
experimental
::
pmr
::
resource_adaptor
<
A
>
(
alloc
)
, wobei
A
der Typ von
alloc
ist. Der Zeiger bleibt nur für die Lebensdauer des
function
Objekts gültig.
|
| Keiner der oben genannten | Das Programm ist fehlerhaft. |
Parameter
| other | - | das Funktionsobjekt, das zur Initialisierung von * this verwendet wird |
| f | - | ein Aufrufbares, das zur Initialisierung von * this verwendet wird |
| alloc | - | ein Allokator, der für interne Speicherzuweisung verwendet wird |
| Typanforderungen | ||
-
F
muss die Anforderungen von
Callable
und
CopyConstructible
erfüllen.
|
||
Ausnahmen
Beispiel
|
Dieser Abschnitt ist unvollständig
Grund: Kein Beispiel |