forked from cpprefjp/site
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
C++26対応として、enable_nonlocking_formatter_optimizationを追加
close cpprefjp#1314 close cpprefjp#1334
- Loading branch information
1 parent
54bc557
commit 9119e06
Showing
12 changed files
with
314 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
reference/chrono/duration/enable_nonlocking_formatter_optimization.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# enable_nonlocking_formatter_optimization | ||
* chrono[meta header] | ||
* std[meta namespace] | ||
* variable[meta id-type] | ||
* cpp26[meta cpp] | ||
|
||
```cpp | ||
namespace std { | ||
template <class Rep, class Period> | ||
inline constexpr bool enable_nonlocking_formatter_optimization< | ||
chrono::duration<Rep, Period>> = | ||
enable_nonlocking_formatter_optimization<Rep>; | ||
} | ||
``` | ||
## 概要 | ||
`duration`クラスに対する[`std::enable_nonlocking_formatter_optimization`](/reference/format/enable_nonlocking_formatter_optimization.md)変数テンプレートの特殊化。 | ||
## バージョン | ||
### 言語 | ||
- C++26 | ||
## 関連項目 | ||
- [`std::enable_nonlocking_formatter_optimization`](/reference/format/enable_nonlocking_formatter_optimization.md) | ||
## 参照 | ||
- [P3107R5 Permit an efficient implementation of `std::print`](https://open-std.org/jtc1/sc22/wg21/docs/papers/2024/p3107r5.html) | ||
- [P3235R3 `std::print` more types faster with less memory](https://open-std.org/jtc1/sc22/wg21/docs/papers/2024/p3235r3.html) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
reference/chrono/zoned_time/enable_nonlocking_formatter_optimization.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# enable_nonlocking_formatter_optimization | ||
* chrono[meta header] | ||
* std[meta namespace] | ||
* variable[meta id-type] | ||
* cpp26[meta cpp] | ||
|
||
```cpp | ||
namespace std { | ||
template <class Duration> | ||
inline constexpr bool enable_nonlocking_formatter_optimization< | ||
chrono::zoned_time<Duration, const chrono::time_zone*>> = true; | ||
} | ||
``` | ||
* chrono::time_zone[link /reference/chrono/time_zone.md] | ||
## 概要 | ||
`zoned_time`クラスに対する[`std::enable_nonlocking_formatter_optimization`](/reference/format/enable_nonlocking_formatter_optimization.md)変数テンプレートの特殊化。 | ||
## バージョン | ||
### 言語 | ||
- C++26 | ||
## 関連項目 | ||
- [`std::enable_nonlocking_formatter_optimization`](/reference/format/enable_nonlocking_formatter_optimization.md) | ||
## 参照 | ||
- [P3107R5 Permit an efficient implementation of `std::print`](https://open-std.org/jtc1/sc22/wg21/docs/papers/2024/p3107r5.html) | ||
- [P3235R3 `std::print` more types faster with less memory](https://open-std.org/jtc1/sc22/wg21/docs/papers/2024/p3235r3.html) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
reference/format/enable_nonlocking_formatter_optimization.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# enable_nonlocking_formatter_optimization | ||
* format[meta header] | ||
* std[meta namespace] | ||
* variable[meta id-type] | ||
* cpp26[meta cpp] | ||
|
||
```cpp | ||
namespace std { | ||
template <class T> | ||
constexpr bool enable_nonlocking_formatter_optimization = false; // (1) C++26 | ||
} | ||
``` | ||
## 概要 | ||
[`std::print()`](/reference/print/print.md)と[`std::println()`](/reference/print/println.md)の効率的な実装を有効にする。 | ||
この値が`true`で定義される場合、文字列フォーマットされた文字列のストリームへの書き込み時に、余分な動的メモリ確保を行わない。 | ||
とくに指定されない限り、標準ライブラリで[`std::formatter`](formatter.md)の特殊化が定義される型に対して、各ヘッダは以下の特殊化を定義する: | ||
```cpp | ||
template<> | ||
inline constexpr bool enable_nonlocking_formatter_optimization<T> = true; | ||
``` | ||
|
||
Rangeに対しては、以下が定義される: | ||
|
||
```cpp | ||
template <ranges::input_range R> | ||
requires (format_kind<R> != range_format::disabled) | ||
inline constexpr bool enable_nonlocking_formatter_optimization<R> = false; | ||
``` | ||
* ranges::input_range[link /reference/ranges/input_range.md] | ||
* format_kind[link format_kind.md] | ||
* range_format[link range_format.md] | ||
[`std::pair`](/reference/utility/pair.md)および[`std::tuple`](/reference/tuple/tuple.md)に対しては、以下が定義される: | ||
```cpp | ||
template <class... Ts> | ||
inline constexpr bool enable_nonlocking_formatter_optimization<pair-or-tuple<Ts...>> = | ||
(enable_nonlocking_formatter_optimization<Ts> && ...); | ||
``` | ||
|
||
|
||
## 備考 | ||
- ユーザーは、任意のCV修飾されないユーザー定義型でこの型の特殊化を定義できる | ||
|
||
|
||
## バージョン | ||
### 言語 | ||
- C++26 | ||
|
||
### 処理系 | ||
- [Clang](/implementation.md#clang): 18 [mark noimpl] | ||
- [GCC](/implementation.md#gcc): 14 [mark noimpl] | ||
- [Visual C++](/implementation.md#visual_cpp): 2022 Update 7 [mark noimpl] | ||
|
||
|
||
## 関連項目 | ||
- [`std::print()`](/reference/print/print.md) | ||
- [`std::chrono::duration`に対する`enable_nonlocking_formatter_optimization`](/reference/chrono/duration/enable_nonlocking_formatter_optimization.md) | ||
- [`std::chrono::zoned_time`に対する`enable_nonlocking_formatter_optimization`](/reference/chrono/zoned_time/enable_nonlocking_formatter_optimization.md) | ||
|
||
|
||
## 参照 | ||
- [P3107R5 Permit an efficient implementation of `std::print`](https://open-std.org/jtc1/sc22/wg21/docs/papers/2024/p3107r5.html) | ||
- [P3235R3 `std::print` more types faster with less memory](https://open-std.org/jtc1/sc22/wg21/docs/papers/2024/p3235r3.html) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# vprint_nonunicode_buffered | ||
* print[meta header] | ||
* std[meta namespace] | ||
* function[meta id-type] | ||
* cpp26[meta cpp] | ||
|
||
```cpp | ||
namespace std { | ||
void vprint_nonunicode_buffered( | ||
FILE* stream, | ||
string_view fmt, | ||
format_args args); // (1) C++26 | ||
} | ||
``` | ||
* FILE[link /reference/cstdio/file.md.nolink] | ||
* format_args[link /reference/format/basic_format_args.md] | ||
## 概要 | ||
確保した文字列バッファに書式指定の出力を作ってから非Unicode出力する。 | ||
## 効果 | ||
- (1) : 以下と等価: | ||
```cpp | ||
string out = vformat(fmt, args); | ||
vprint_nonunicode("{}", make_format_args(out)); | ||
``` | ||
* string[link /reference/string/basic_string.md] | ||
* vformat[link /reference/format/vformat.md] | ||
* vprint_nonunicode[link vprint_nonunicode.md] | ||
* make_format_args[link /reference/format/make_format_args.md] | ||
|
||
|
||
## バージョン | ||
### 言語 | ||
- C++26 | ||
|
||
### 処理系 | ||
- [Clang](/implementation.md#clang): 18 [mark noimpl] | ||
- [GCC](/implementation.md#gcc): 14 [mark noimpl] | ||
- [Visual C++](/implementation.md#visual_cpp): 2022 Update 7 [mark noimpl] | ||
|
||
|
||
## 関連項目 | ||
- [`std::print()`](print.md) | ||
- [`std::println()`](println.md) | ||
- [`std::vprint_nonunicode()`](vprint_nonunicode.md) | ||
|
||
|
||
## 参照 | ||
- [P3107R5 Permit an efficient implementation of `std::print`](https://open-std.org/jtc1/sc22/wg21/docs/papers/2024/p3107r5.html) | ||
- [P3235R3 `std::print` more types faster with less memory](https://open-std.org/jtc1/sc22/wg21/docs/papers/2024/p3235r3.html) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.