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-06-05T11:15:28.581671 </updated >
6
- <id >77f1a2eb-d277-4dc4-be5e-3faa88c51658 </id >
5
+ <updated >2025-06-05T11:27:05.011143 </updated >
6
+ <id >fe1daf9b-c762-4c86-8bfe-54a7d2a3d564 </id >
7
7
8
8
9
+ <entry >
10
+ <title >ws -- add sample to std::ws</title >
11
+ <link href =" https://cpprefjp.github.io/reference/istream/ws.html" />
12
+ <id >1a53cfe9f233ee2fd70f96ff186f7c04ab38a160:reference/istream/ws.md</id >
13
+ <updated >2025-06-05T20:23:01+09:00</updated >
14
+
15
+ <summary type =" html" >< pre>< code> diff --git a/reference/istream/ws.md b/reference/istream/ws.md
16
+ index c523930ba..58dea186d 100644
17
+ --- a/reference/istream/ws.md
18
+ +++ b/reference/istream/ws.md
19
+ @@ -24,13 +24,36 @@ namespace std {
20
+ `is`
21
+
22
+ ## 例
23
+ -TBD
24
+ +```cpp
25
+ +#include & lt;iostream& gt;
26
+ +#include & lt;sstream& gt;
27
+ +#include & lt;string& gt;
28
+ +
29
+ +int main() {
30
+ + // マニピュレータとして使用
31
+ + {
32
+ + std::istringstream ss(& #34; 42& #34;);
33
+ + std::string line;
34
+ + std::getline(ss & gt;& gt; std::ws, line);
35
+ + std::cout & lt;& lt; line & lt;& lt; std::endl; // & #34;42& #34;
36
+ + }
37
+ +
38
+ + // 関数として使用(通常はしない)
39
+ + {
40
+ + std::istringstream ss(& #34; 42& #34;);
41
+ + std::cout & lt;& lt; ss.tellg() & lt;& lt; std::endl; // & #34;0& #34;
42
+ + std::ws(ss);
43
+ + std::cout & lt;& lt; ss.tellg() & lt;& lt; std::endl; // & #34;3& #34;
44
+ + }
45
+ +}
46
+ +```
47
+
48
+ ### 出力
49
+ -TBD
50
+ -
51
+ -## 実装例
52
+ -TBD
53
+ +```
54
+ +42
55
+ +0
56
+ +3
57
+ +```
58
+
59
+ ## バージョン
60
+ ### 言語
61
+ < /code>< /pre> </summary >
62
+
63
+ <author >
64
+ <name >suomesta</name >
65
+
66
+ </author >
67
+ </entry >
68
+
9
69
<entry >
10
70
<title >operator>> (非メンバ関数) -- fix typo in basic_istream</title >
11
71
<link href =" https://cpprefjp.github.io/reference/istream/basic_istream/op_istream_free.html" />
@@ -3064,39 +3124,4 @@ index 000000000..767963f4f
3064
3124
</author >
3065
3125
</entry >
3066
3126
3067
- <entry >
3068
- <title >unreachable_sentinel_t -- unreachable_sentinel: 説明を修正</title >
3069
- <link href =" https://cpprefjp.github.io/reference/iterator/unreachable_sentinel_t.html" />
3070
- <id >c4d5bec557079e03eb029537a59c5b9964d8c5c3:reference/iterator/unreachable_sentinel_t.md</id >
3071
- <updated >2025-06-05T03:01:33+09:00</updated >
3072
-
3073
- <summary type =" html" >< pre>< code> diff --git a/reference/iterator/unreachable_sentinel_t.md b/reference/iterator/unreachable_sentinel_t.md
3074
- index 4694befc9..15ecfbff8 100644
3075
- --- a/reference/iterator/unreachable_sentinel_t.md
3076
- +++ b/reference/iterator/unreachable_sentinel_t.md
3077
- @@ -19,11 +19,13 @@ namespace std {
3078
-
3079
- ## 概要
3080
-
3081
- -`unreachable_sentinel_t`は、`weakly_incrementable`な型(イテレータ型)とともに用いて、任意の(半)開区間の上界を示すことのできる番兵型である。
3082
- +`unreachable_sentinel_t`は、`weakly_incrementable`な型(主にイテレータ型)とともに用いて、非有界な区間の上界を表すことのできる番兵型である。
3083
-
3084
- -検索などを目的として範囲を走査する際、検索対象が範囲内に存在している場合その終端まで到達することは無く、範囲の探索は必ずしも範囲の先頭から行われる訳でも無い。任意の(半)開区間とは、ある範囲の内部にあるその様な走査の対象となる部分範囲のことを指す。`unreachable_sentinel`はその様な区間の終端を暗に指定する、その様な開区間の上界を表す番兵である。
3085
- +非有界な区間とは無限長の範囲のように、その終端が指定されない区間(範囲)のこと。そのような範囲の走査に対して`unreachable_sentinel`を使用して、別の方法によって範囲の終端が示されることを表し、それによって区間の上界を指定することができる。
3086
-
3087
- -検索など、ある範囲の一部を走査する際にそのイテレータに対する番兵として用いる事で、範囲の終端チェックを省略して走査を効率化できる可能性がある。ただし、実際の終端に到達しても走査が終了しないため、利用にあたっては事前条件(終端となる値が存在しているか)が必ず満たされるかに注意を払う必要がある。
3088
- +1つの使い方は、無限長の範囲や`view`の番兵型として指定することで、その長さが無制限であることを表すことである。[`views::iota`](/reference/ranges/iota_view.md)や[`views::repeat`](/reference/ranges/repeat_view.md)でそのような使用方法を見ることができる。
3089
- +
3090
- +もう一つの使い方として、検索などにおいてある範囲の一部を走査する際にそのイテレータに対する番兵として用いる事で、範囲の終端チェックを省略して走査を効率化できる可能性がある。ただし、実際の終端に到達しても走査が終了しないため、利用にあたっては事前条件(終端となる値が存在しているか)が必ず満たされるかに注意を払う必要がある。
3091
-
3092
- ## 非メンバ(*Hidden friends*)関数
3093
-
3094
- < /code>< /pre> </summary >
3095
-
3096
- <author >
3097
- <name >onihusube</name >
3098
-
3099
- </author >
3100
- </entry >
3101
-
3102
3127
</feed >
0 commit comments