Skip to content

Commit 9abda6d

Browse files
author
cpprefjp-autoupdate
committed
update automatically
1 parent b75ea26 commit 9abda6d

File tree

3 files changed

+93
-45
lines changed

3 files changed

+93
-45
lines changed

reference/istream/ws.html

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -188,12 +188,12 @@
188188

189189
<p class="text-right"><small>
190190
最終更新日時(UTC):
191-
<span itemprop="datePublished" content="2017-03-15T08:17:19">
192-
2017年03月15日 08時17分19秒
191+
<span itemprop="datePublished" content="2025-06-05T11:23:01">
192+
2025年06月05日 11時23分01秒
193193
</span>
194194
<br/>
195195
<span itemprop="author" itemscope itemtype="http://schema.org/Person">
196-
<span itemprop="name">Akira Takahashi</span>
196+
<span itemprop="name">suomesta</span>
197197
</span>
198198
が更新
199199
</small></p>
@@ -233,11 +233,34 @@ <h2>効果</h2>
233233
<h2><a class="cpprefjp-defined-word" data-desc="関数呼び出し式の評価結果となるオブジェクト・値">戻り値</a></h2>
234234
<p><code>is</code></p>
235235
<h2></h2>
236-
<p>TBD</p>
236+
<p><div class="codehilite"><pre><span></span><code><span class="cp">#include</span> <span class="cpf"><a href="../iostream.html">&lt;iostream&gt;</a></span><span class="cp"></span>
237+
<span class="cp">#include</span> <span class="cpf"><a href="../sstream.html">&lt;sstream&gt;</a></span><span class="cp"></span>
238+
<span class="cp">#include</span> <span class="cpf"><a href="../string.html">&lt;string&gt;</a></span><span class="cp"></span>
239+
240+
<span class="kt">int</span> <span class="nf">main</span><span class="p">()</span> <span class="p">{</span>
241+
<span class="c1">// マニピュレータとして使用</span>
242+
<span class="p">{</span>
243+
<span class="n"><span href="https://cpprefjp.github.io/reference/sstream/basic_istream.html">std::istringstream</span></span> <span class="n">ss</span><span class="p">(</span><span class="s">" 42"</span><span class="p">);</span>
244+
<span class="n"><a href="../string/basic_string.html">std::string</a></span> <span class="n">line</span><span class="p">;</span>
245+
<span class="n">std</span><span class="o">::</span><span class="n">getline</span><span class="p">(</span><span class="n">ss</span> <span class="o">&gt;&gt;</span> <span class="n">std</span><span class="o">::</span><span class="n">ws</span><span class="p">,</span> <span class="n">line</span><span class="p">);</span>
246+
<span class="n"><a href="../iostream/cout.html">std::cout</a></span> <span class="o">&lt;&lt;</span> <span class="n">line</span> <span class="o">&lt;&lt;</span> <span class="n"><a href="../ostream/endl.html">std::endl</a></span><span class="p">;</span> <span class="c1">// "42"</span>
247+
<span class="p">}</span>
248+
249+
<span class="c1">// 関数として使用(通常はしない)</span>
250+
<span class="p">{</span>
251+
<span class="n"><span href="https://cpprefjp.github.io/reference/sstream/basic_istream.html">std::istringstream</span></span> <span class="n">ss</span><span class="p">(</span><span class="s">" 42"</span><span class="p">);</span>
252+
<span class="n"><a href="../iostream/cout.html">std::cout</a></span> <span class="o">&lt;&lt;</span> <span class="n">ss</span><span class="p">.</span><span class="n">tellg</span><span class="p">()</span> <span class="o">&lt;&lt;</span> <span class="n"><a href="../ostream/endl.html">std::endl</a></span><span class="p">;</span> <span class="c1">// "0"</span>
253+
<span class="n">std</span><span class="o">::</span><span class="n">ws</span><span class="p">(</span><span class="n">ss</span><span class="p">);</span>
254+
<span class="n"><a href="../iostream/cout.html">std::cout</a></span> <span class="o">&lt;&lt;</span> <span class="n">ss</span><span class="p">.</span><span class="n">tellg</span><span class="p">()</span> <span class="o">&lt;&lt;</span> <span class="n"><a href="../ostream/endl.html">std::endl</a></span><span class="p">;</span> <span class="c1">// "3"</span>
255+
<span class="p">}</span>
256+
<span class="p">}</span>
257+
</code></pre></div>
258+
</p>
237259
<h3>出力</h3>
238-
<p>TBD</p>
239-
<h2>実装例</h2>
240-
<p>TBD</p>
260+
<p><pre><code>42
261+
0
262+
3
263+
</code></pre></p>
241264
<h2>バージョン</h2>
242265
<h3>言語</h3>
243266
<ul>

rss.xml

Lines changed: 62 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,70 @@
22
<feed xmlns="http://www.w3.org/2005/Atom">
33
<title>cpprefjp - C++日本語リファレンス</title>
44
<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>
77

88

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">&lt;pre&gt;&lt;code&gt;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 &amp;lt;iostream&amp;gt;
26+
+#include &amp;lt;sstream&amp;gt;
27+
+#include &amp;lt;string&amp;gt;
28+
+
29+
+int main() {
30+
+ // マニピュレータとして使用
31+
+ {
32+
+ std::istringstream ss(&amp;#34; 42&amp;#34;);
33+
+ std::string line;
34+
+ std::getline(ss &amp;gt;&amp;gt; std::ws, line);
35+
+ std::cout &amp;lt;&amp;lt; line &amp;lt;&amp;lt; std::endl; // &amp;#34;42&amp;#34;
36+
+ }
37+
+
38+
+ // 関数として使用(通常はしない)
39+
+ {
40+
+ std::istringstream ss(&amp;#34; 42&amp;#34;);
41+
+ std::cout &amp;lt;&amp;lt; ss.tellg() &amp;lt;&amp;lt; std::endl; // &amp;#34;0&amp;#34;
42+
+ std::ws(ss);
43+
+ std::cout &amp;lt;&amp;lt; ss.tellg() &amp;lt;&amp;lt; std::endl; // &amp;#34;3&amp;#34;
44+
+ }
45+
+}
46+
+```
47+
48+
### 出力
49+
-TBD
50+
-
51+
-## 実装例
52+
-TBD
53+
+```
54+
+42
55+
+0
56+
+3
57+
+```
58+
59+
## バージョン
60+
### 言語
61+
&lt;/code&gt;&lt;/pre&gt;</summary>
62+
63+
<author>
64+
<name>suomesta</name>
65+
<email>[email protected]</email>
66+
</author>
67+
</entry>
68+
969
<entry>
1070
<title>operator&gt;&gt; (非メンバ関数) -- fix typo in basic_istream</title>
1171
<link href="https://cpprefjp.github.io/reference/istream/basic_istream/op_istream_free.html"/>
@@ -3064,39 +3124,4 @@ index 000000000..767963f4f
30643124
</author>
30653125
</entry>
30663126

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">&lt;pre&gt;&lt;code&gt;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-
&lt;/code&gt;&lt;/pre&gt;</summary>
3095-
3096-
<author>
3097-
<name>onihusube</name>
3098-
<email>[email protected]</email>
3099-
</author>
3100-
</entry>
3101-
31023127
</feed>

sitemap.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34541,7 +34541,7 @@
3454134541

3454234542
<url>
3454334543
<loc>https://cpprefjp.github.io/reference/istream/ws.html</loc>
34544-
<lastmod>2025-04-03T12:32:11+09:00</lastmod>
34544+
<lastmod>2025-06-05T20:23:01+09:00</lastmod>
3454534545
<changefreq>daily</changefreq>
3454634546
<priority>0.7</priority>
3454734547
</url>

0 commit comments

Comments
 (0)