std:: enable_nonlocking_formatter_optimization
|
Definiert im Header
<format>
|
||
|
template
<
class
T
>
constexpr bool enable_nonlocking_formatter_optimization = false ; |
(seit C++23) | |
Diese Vorlage kann von Implementierungen verwendet werden, um effiziente Implementierungen von std::print und std::println zu ermöglichen.
Wenn
std::enable_nonlocking_formatter_optimization<T>
true
ist, kann die Ausgabe eines Arguments vom Typ
T
auf effizientere Weise durchgeführt werden (siehe
std::print
für Details).
Spezialisierungen von
std::enable_nonlocking_formatter_optimization
können in folgenden Fällen
true
sein:
-
Tist einer der Typen, für die std::formatter < T, CharT > eine grundlegende Standardspezialisierung oder Standardspezialisierung für einen Bibliothekstyp ist (siehe unten). -
Ein Programm kann diese Vorlage für jeden cv-unqualifizierten
programmdefinierten Typ
Tspezialisieren. Solche Spezialisierungen müssen in konstanten Ausdrücken verwendbar sein und den Typ const bool haben.
Inhaltsverzeichnis |
Grundlegende Standardspezialisierungen
In der folgenden Liste ist
CharT
entweder
char
oder
wchar_t
,
ArithmeticT
ist jeder cv-unqualifizierte arithmetische Typ außer
char
,
wchar_t
,
char8_t
,
char16_t
oder
char32_t
:
|
Nonlocking-Flag für Zeichenformatierer
|
||
|
template
<>
constexpr bool enable_nonlocking_formatter_optimization < CharT > = true ; |
(1) | |
|
Nonlocking-Flag für Zeichenkettenformatierer
|
||
|
template
<>
constexpr bool enable_nonlocking_formatter_optimization < CharT * > = true ; |
(2) | |
|
template
<>
constexpr bool enable_nonlocking_formatter_optimization < const CharT * > = true ; |
(3) | |
|
template
<
std::
size_t
N
>
constexpr bool enable_nonlocking_formatter_optimization < CharT [ N ] > = true ; |
(4) | |
|
template
<
class
Traits,
class
Alloc
>
constexpr
bool
enable_nonlocking_formatter_optimization
|
(5) | |
|
template
<
class
Traits
>
constexpr
bool
enable_nonlocking_formatter_optimization
|
(6) | |
|
Nonlocking-Flag für arithmetische Formatierer
|
||
|
template
<>
constexpr bool enable_nonlocking_formatter_optimization < ArithmeticT > = true ; |
(7) | |
|
Nonlocking-Flag für Zeigerformatierer
|
||
|
template
<>
constexpr bool enable_nonlocking_formatter_optimization < std:: nullptr_t > = true ; |
(8) | |
|
template
<>
constexpr bool enable_nonlocking_formatter_optimization < void * > = true ; |
(9) | |
|
template
<>
constexpr bool enable_nonlocking_formatter_optimization < const void * > = true ; |
(10) | |
Standardspezialisierungen für Bibliothekstypen
Spezialisierungen von
enable_nonlocking_formatter_optimization
für alle Spezialisierungen der folgenden Standard-Templates sind definiert als
true
:
-
std::chrono::zoned_time
wenn sein Template-Parameter-Typ
TimeZonePtrconst std:: chrono :: time_zone * ist
Spezialisierungen von
enable_nonlocking_formatter_optimization
für alle Spezialisierungen der folgenden Standardtemplates sind bedingt als
true
definiert:
Spezialisierung von
enable_nonlocking_formatter_optimization
für alle
formattierbaren Bereichstypen
sind immer als
false
definiert, für die der Bereichsformattyp nicht
std
::
range_format
::
disabled
ist.
Hinweise
| Feature-Test Makro | Wert | Std | Funktion |
|---|---|---|---|
__cpp_lib_print
|
202403L
|
(C++26)
(DR23) |
Formatierte Ausgabe mit Stream-Sperrung |
202406L
|
(C++26)
(DR23) |
Aktivierung der Nicht-Sperrungs-Formatter-Optimierung für weitere formatierbare Typen |
Siehe auch
|
(C++20)
|
definiert Formatierungsregeln für einen gegebenen Typ
(Klassentemplate) |
|
(C++23)
|
gibt auf
stdout
oder einen Dateistrom unter Verwendung einer
formatierten
Darstellung der Argumente aus
(Funktionstemplate) |
|
(C++23)
|
identisch mit
std::print
außer dass jede Ausgabe durch eine zusätzliche neue Zeile abgeschlossen wird
(Funktionstemplate) |