2
2
<feed xmlns =" http://www.w3.org/2005/Atom" >
3
3
<title >cpprefjp - C++日本語リファレンス</title >
4
4
<link href =" https://cpprefjp.github.io" />
5
- <updated >2025-01-21T02:27:05.283653 </updated >
6
- <id >14a352f3-a744-424d-8c0f-5d9c2909b7f1 </id >
5
+ <updated >2025-01-21T02:45:21.388353 </updated >
6
+ <id >656f232e-8c2b-46c3-9144-ee5912ada22d </id >
7
7
8
8
9
+ <entry >
10
+ <title >行末スペースを無視するよう規定 [P2223R2] -- P2223R2の解説を修正 (#1405)</title >
11
+ <link href =" https://cpprefjp.github.io/lang/cpp23/trimming_whitespaces_before_line_splicing.html" />
12
+ <id >b394b14811a52179cdf0cfbd26948978170ab73e:lang/cpp23/trimming_whitespaces_before_line_splicing.md</id >
13
+ <updated >2025-01-21T11:42:00+09:00</updated >
14
+
15
+ <summary type =" html" >< pre>< code> diff --git a/lang/cpp23/trimming_whitespaces_before_line_splicing.md b/lang/cpp23/trimming_whitespaces_before_line_splicing.md
16
+ index 5f97c4768..7aaba26e6 100644
17
+ --- a/lang/cpp23/trimming_whitespaces_before_line_splicing.md
18
+ +++ b/lang/cpp23/trimming_whitespaces_before_line_splicing.md
19
+ @@ -34,7 +34,7 @@ int main() {
20
+ }
21
+ ```
22
+
23
+ -このコードにおいて「`// \`」のあとにはスペースがあり、EDG (ICCのフロントエンド)、GCC、Clangは行末スペースをトリミング (削除) して関数`f()`は`43`を返すが、MSVCはトリミングせず`1`を返していた。プラットフォーム間の動作差異をなくすために、実装は行末スペースをトリミングしなければならないよう提案することとした。
24
+ +このコードにおいて「`// \`」のあとにはスペースがあり、EDG (ICCのフロントエンド)、GCC、Clangは行末スペースをトリミング (削除) して関数`f()`は`1`を返すが、MSVCはトリミングせず`43`を返していた。プラットフォーム間の動作差異をなくすために、実装は行末スペースをトリミングしなければならないよう提案することとした。
25
+
26
+ 例として、IDEやツール (コードフォーマッタ) はそのような行末スペースを削除する可能性があり、Googleのコーディングスタイルでは行末スペースを禁止している。
27
+
28
+ @@ -66,4 +66,4 @@ int main() {
29
+
30
+
31
+ ## 参照
32
+ -- [P2223R2 Trimming whitespaces before line splicing](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2223r2.pdf)
33
+ \ No newline at end of file
34
+ +- [P2223R2 Trimming whitespaces before line splicing](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2223r2.pdf)
35
+ < /code>< /pre> </summary >
36
+
37
+ <author >
38
+ <name >0xbadfca11</name >
39
+ <email >0xbadfca11@gmail.com</email >
40
+ </author >
41
+ </entry >
42
+
9
43
<entry >
10
44
<title >コンパイラの実装状況 -- Merge pull request #1404 from 0xbadfca11/patch-1</title >
11
45
<link href =" https://cpprefjp.github.io/implementation-status.html" />
@@ -3798,326 +3832,4 @@ index 4f589ec16..c5c2d0995 100644
3798
3832
</author >
3799
3833
</entry >
3800
3834
3801
- <entry >
3802
- <title >flat_map -- add extract() and replace() to flat_map (#1078)</title >
3803
- <link href =" https://cpprefjp.github.io/reference/flat_map/flat_map.html" />
3804
- <id >edf7962b602ce9a349eb74f0881da4b10202c4ee:reference/flat_map/flat_map.md</id >
3805
- <updated >2025-01-20T21:47:26+09:00</updated >
3806
-
3807
- <summary type =" html" >< pre>< code> diff --git a/reference/flat_map/flat_map.md b/reference/flat_map/flat_map.md
3808
- index c2887c226..3ed7bc59b 100644
3809
- --- a/reference/flat_map/flat_map.md
3810
- +++ b/reference/flat_map/flat_map.md
3811
- @@ -66,8 +66,8 @@ namespace std {
3812
- | [`try_emplace`](flat_map/try_emplace.md) | キーが存在しない場合のみ要素を直接構築する | C++23 |
3813
- | [`erase`](flat_map/erase.md) | 要素を削除する | C++23 |
3814
- | [`swap`](flat_map/swap.md) | コンテンツを交換する | C++23 |
3815
- -| [`extract`](flat_map/extract.md.nolink) | キーのコンテナ、値のコンテナを取得する | C++23 |
3816
- -| [`replace`](flat_map/replace.md.nolink) | キーのコンテナ、値のコンテナを置き換える | C++23 |
3817
- +| [`extract`](flat_map/extract.md) | キーのコンテナ、値のコンテナを取得する | C++23 |
3818
- +| [`replace`](flat_map/replace.md) | キーのコンテナ、値のコンテナを置き換える | C++23 |
3819
-
3820
-
3821
- ### 要素アクセス
3822
- < /code>< /pre> </summary >
3823
-
3824
- <author >
3825
- <name >suomesta</name >
3826
- <email >shawn316michaels@gmail.com</email >
3827
- </author >
3828
- </entry >
3829
-
3830
- <entry >
3831
- <title >flat_map::containers -- add extract() and replace() to flat_map (#1078)</title >
3832
- <link href =" https://cpprefjp.github.io/reference/flat_map/flat_map/containers.html" />
3833
- <id >edf7962b602ce9a349eb74f0881da4b10202c4ee:reference/flat_map/flat_map/containers.md</id >
3834
- <updated >2025-01-20T21:47:26+09:00</updated >
3835
-
3836
- <summary type =" html" >< pre>< code> diff --git a/reference/flat_map/flat_map/containers.md b/reference/flat_map/flat_map/containers.md
3837
- index 16e454e48..4f589ec16 100644
3838
- --- a/reference/flat_map/flat_map/containers.md
3839
- +++ b/reference/flat_map/flat_map/containers.md
3840
- @@ -29,7 +29,7 @@ namespace std {
3841
- ## 概要
3842
- `flat_map`クラス内部のデータ保持方法として、キーのコンテナと値のコンテナをもつ。
3843
-
3844
- -この形式の内部表現は[`extract()`](extract.md.nolink)メンバ関数で取得でき、シリアライズなどの用途に使用できる。
3845
- +この形式の内部表現は [`extract()`](extract.md) メンバ関数で取得でき、シリアライズなどの用途に使用できる。
3846
-
3847
-
3848
- ## 例
3849
- @@ -38,6 +38,7 @@ namespace std {
3850
- #include & lt;iostream& gt;
3851
- #include & lt;flat_map& gt;
3852
- #include & lt;string& gt;
3853
- +#include & lt;utility& gt;
3854
-
3855
- int main()
3856
- {
3857
- @@ -47,21 +48,21 @@ int main()
3858
- {& #34;Carol& #34;, 4}
3859
- };
3860
-
3861
- - decltype(fm)::containers c = fm.extract();
3862
- + decltype(fm)::containers c = std::move(fm).extract();
3863
-
3864
- - std::cout & lt;& lt; & #34;keys:& #34;
3865
- + std::cout & lt;& lt; & #34;keys:& #34; & lt;& lt; std::endl;
3866
- for (const auto& amp; key : c.keys) {
3867
- std::cout & lt;& lt; & #34; & #34; & lt;& lt; key & lt;& lt; std::endl;
3868
- }
3869
-
3870
- - std::cout & lt;& lt; & #34;values:& #34;
3871
- + std::cout & lt;& lt; & #34;values:& #34; & lt;& lt; std::endl;
3872
- for (const auto& amp; value : c.values) {
3873
- std::cout & lt;& lt; & #34; & #34; & lt;& lt; value & lt;& lt; std::endl;
3874
- }
3875
- }
3876
- ```
3877
- * containers[color ff0000]
3878
- -* fm.extract()[link extract.md.nolink]
3879
- +* fm.extract()[link extract.md]
3880
-
3881
- #### 出力
3882
- ```
3883
- @@ -84,3 +85,7 @@ values:
3884
- - [Clang](/implementation.md#clang): ??
3885
- - [GCC](/implementation.md#gcc): ??
3886
- - [Visual C++](/implementation.md#visual_cpp): ??
3887
- +
3888
- +
3889
- +## 関連項目
3890
- +- [`extract`](extract.md)
3891
- < /code>< /pre> </summary >
3892
-
3893
- <author >
3894
- <name >suomesta</name >
3895
- <email >shawn316michaels@gmail.com</email >
3896
- </author >
3897
- </entry >
3898
-
3899
- <entry >
3900
- <title >extract -- add extract() and replace() to flat_map (#1078)</title >
3901
- <link href =" https://cpprefjp.github.io/reference/flat_map/flat_map/extract.html" />
3902
- <id >edf7962b602ce9a349eb74f0881da4b10202c4ee:reference/flat_map/flat_map/extract.md</id >
3903
- <updated >2025-01-20T21:47:26+09:00</updated >
3904
-
3905
- <summary type =" html" >< pre>< code> diff --git a/reference/flat_map/flat_map/extract.md b/reference/flat_map/flat_map/extract.md
3906
- new file mode 100644
3907
- index 000000000..0aa1cbb9e
3908
- --- /dev/null
3909
- +++ b/reference/flat_map/flat_map/extract.md
3910
- @@ -0,0 +1,90 @@
3911
- +# extract
3912
- +* flat_map[meta header]
3913
- +* std[meta namespace]
3914
- +* flat_map[meta class]
3915
- +* function[meta id-type]
3916
- +* cpp23[meta cpp]
3917
- +
3918
- +```cpp
3919
- +containers extract() & amp;& amp;; // C++23
3920
- +```
3921
- +
3922
- +## 概要
3923
- +キーのコンテナ、値のコンテナを戻り値として返す。
3924
- +
3925
- +
3926
- +## 戻り値
3927
- +クラス内部のデータ保持形式である [`containers`](containers.md) オブジェクト。
3928
- +
3929
- +
3930
- +## 事後条件
3931
- +呼び出し側の `flat_map` は空になる(たとえ例外で関数が中断されたとしても)。
3932
- +
3933
- +
3934
- +## 計算量
3935
- +定数時間。
3936
- +
3937
- +
3938
- +## 備考
3939
- +本関数は右辺値修飾されているので、右辺値からのみ読み出し可能である。
3940
- +
3941
- +
3942
- +## 例
3943
- +```cpp example
3944
- +#include & lt;flat_map& gt;
3945
- +#include & lt;iostream& gt;
3946
- +#include & lt;string& gt;
3947
- +#include & lt;utility& gt;
3948
- +
3949
- +int main()
3950
- +{
3951
- + std::flat_map& lt;std::string, int& gt; fm = {
3952
- + {& #34;Alice& #34;, 3},
3953
- + {& #34;Bob& #34;, 1},
3954
- + {& #34;Carol& #34;, 4}
3955
- + };
3956
- +
3957
- + std::cout & lt;& lt; fm.size() & lt;& lt; std::endl;
3958
- +
3959
- + decltype(fm)::containers c = std::move(fm).extract();
3960
- +
3961
- + std::cout & lt;& lt; fm.size() & lt;& lt; std::endl;
3962
- + std::cout & lt;& lt; std::endl;
3963
- +
3964
- + auto k = c.keys.cbegin();
3965
- + auto v = c.values.cbegin();
3966
- + std::cout & lt;& lt; & #34;{& #34; & lt;& lt; std::endl;
3967
- + for (; k != c.keys.cend() & amp;& amp; v != c.values.cend(); ++k, ++v) {
3968
- + std::cout & lt;& lt; & #34; & #34; & lt;& lt; *k & lt;& lt; & #34;: & #34; & lt;& lt; *v & lt;& lt; & #34;,& #34; & lt;& lt; std::endl;
3969
- + }
3970
- + std::cout & lt;& lt; & #34;}& #34; & lt;& lt; std::endl;
3971
- +}
3972
- +```
3973
- +* extract()[color ff0000]
3974
- +* fm.size()[link size.md]
3975
- +
3976
- +### 出力
3977
- +```
3978
- +3
3979
- +0
3980
- +
3981
- +{
3982
- + Alice: 3,
3983
- + Bob: 1,
3984
- + Carol: 4,
3985
- +}
3986
- +```
3987
- +
3988
- +## バージョン
3989
- +### 言語
3990
- +- C++23
3991
- +
3992
- +### 処理系
3993
- +- [Clang](/implementation.md#clang): ??
3994
- +- [GCC](/implementation.md#gcc): ??
3995
- +- [ICC](/implementation.md#icc): ??
3996
- +- [Visual C++](/implementation.md#visual_cpp): ??
3997
- +
3998
- +
3999
- +## 関連項目
4000
- +- [`containers`](containers.md)
4001
- < /code>< /pre> </summary >
4002
-
4003
- <author >
4004
- <name >suomesta</name >
4005
- <email >shawn316michaels@gmail.com</email >
4006
- </author >
4007
- </entry >
4008
-
4009
- <entry >
4010
- <title >replace -- add extract() and replace() to flat_map (#1078)</title >
4011
- <link href =" https://cpprefjp.github.io/reference/flat_map/flat_map/replace.html" />
4012
- <id >edf7962b602ce9a349eb74f0881da4b10202c4ee:reference/flat_map/flat_map/replace.md</id >
4013
- <updated >2025-01-20T21:47:26+09:00</updated >
4014
-
4015
- <summary type =" html" >< pre>< code> diff --git a/reference/flat_map/flat_map/replace.md b/reference/flat_map/flat_map/replace.md
4016
- new file mode 100644
4017
- index 000000000..07ff97fd7
4018
- --- /dev/null
4019
- +++ b/reference/flat_map/flat_map/replace.md
4020
- @@ -0,0 +1,94 @@
4021
- +# replace
4022
- +* flat_map[meta header]
4023
- +* std[meta namespace]
4024
- +* flat_map[meta class]
4025
- +* function[meta id-type]
4026
- +* cpp23[meta cpp]
4027
- +
4028
- +```cpp
4029
- +void replace(key_container_type& amp;& amp; key_cont, mapped_container_type& amp;& amp; mapped_cont); // C++23
4030
- +```
4031
- +
4032
- +## 概要
4033
- +キーのコンテナ、値のコンテナをそれぞれ置き換える。
4034
- +
4035
- +
4036
- +## 効果
4037
- +`flat_map` クラスが内部で保持している [`containers`](containers.md) を `c` とすると、以下と等価。
4038
- + ```cpp
4039
- + c.keys = std::move(key_cont);
4040
- + c.values = std::move(mapped_cont)
4041
- + ```
4042
- +
4043
- +
4044
- +## 事前条件
4045
- +- `key_cont.size() == mapped_cont.size()` が真であること。
4046
- +- `key_cont` が `key_compare` に基づいてソートされていること。
4047
- +- `key_cont` に重複する要素がないこと。
4048
- +
4049
- +
4050
- +## 計算量
4051
- +`key_cont` および `mapped_cont` をムーブした計算量と同じ。
4052
- +
4053
- +
4054
- +## 例
4055
- +```cpp example
4056
- +#include & lt;algorithm& gt;
4057
- +#include & lt;cassert& gt;
4058
- +#include & lt;flat_map& gt;
4059
- +#include & lt;iostream& gt;
4060
- +#include & lt;string& gt;
4061
- +#include & lt;utility& gt;
4062
- +
4063
- +int main()
4064
- +{
4065
- + std::vector& lt;std::string& gt; keys = {& #34;Alice& #34;, & #34;Bob& #34;, & #34;Carol& #34;};
4066
- + std::vector& lt;int& gt; values = {3, 1, 4};
4067
- +
4068
- + // 事前条件の確認
4069
- + assert(keys.size() == values.size());
4070
- + assert(std::is_sorted(keys.begin(), keys.end()));
4071
- + assert(std::adjacent_find(keys.begin(), keys.end()) == keys.end());
4072
- +
4073
- + std::flat_map& lt;std::string, int& gt; fm;
4074
- +
4075
- + std::cout & lt;& lt; fm.size() & lt;& lt; std::endl;
4076
- +
4077
- + fm.replace(std::move(keys), std::move(values));
4078
- +
4079
- + std::cout & lt;& lt; fm.size() & lt;& lt; std::endl;
4080
- + std::cout & lt;& lt; std::endl;
4081
- +
4082
- + std::cout & lt;& lt; & #34;{& #34; & lt;& lt; std::endl;
4083
- + for (const auto& amp; kv: fm) {
4084
- + std::cout & lt;& lt; & #34; & #34; & lt;& lt; kv.first & lt;& lt; & #34;: & #34; & lt;& lt; kv.second & lt;& lt; & #34;,& #34; & lt;& lt; std::endl;
4085
- + }
4086
- + std::cout & lt;& lt; & #34;}& #34; & lt;& lt; std::endl;
4087
- +}
4088
- +```
4089
- +* replace[color ff0000]
4090
- +* fm.size()[link size.md]
4091
- +* std::is_sorted[link /reference/algorithm/is_sorted.md]
4092
- +* std::adjacent_find[link /reference/algorithm/adjacent_find.md]
4093
- +
4094
- +### 出力
4095
- +```
4096
- +0
4097
- +3
4098
- +
4099
- +{
4100
- + Alice: 3,
4101
- + Bob: 1,
4102
- + Carol: 4,
4103
- +}
4104
- +```
4105
- +
4106
- +## バージョン
4107
- +### 言語
4108
- +- C++23
4109
- +
4110
- +### 処理系
4111
- +- [Clang](/implementation.md#clang): ??
4112
- +- [GCC](/implementation.md#gcc): ??
4113
- +- [ICC](/implementation.md#icc): ??
4114
- +- [Visual C++](/implementation.md#visual_cpp): ??
4115
- < /code>< /pre> </summary >
4116
-
4117
- <author >
4118
- <name >suomesta</name >
4119
- <email >shawn316michaels@gmail.com</email >
4120
- </author >
4121
- </entry >
4122
-
4123
3835
</feed >
0 commit comments