Skip to content

Commit 069c50d

Browse files
author
cpprefjp-autoupdate
committed
update automatically
1 parent 5149093 commit 069c50d

File tree

3 files changed

+34
-106
lines changed

3 files changed

+34
-106
lines changed

reference/deque/deque/erase.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -200,12 +200,12 @@
200200

201201
<p class="text-right"><small>
202202
最終更新日時(UTC):
203-
<span itemprop="datePublished" content="2022-12-28T02:13:14">
204-
2022年12月28日 02時13分14秒
203+
<span itemprop="datePublished" content="2025-07-08T13:49:10">
204+
2025年07月08日 13時49分10秒
205205
</span>
206206
<br/>
207207
<span itemprop="author" itemscope itemtype="http://schema.org/Person">
208-
<span itemprop="name">Akira Takahashi</span>
208+
<span itemprop="name">onihusube</span>
209209
</span>
210210
が更新
211211
</small></p>
@@ -239,7 +239,7 @@ <h2>効果</h2>
239239
<li>(1) : <code>position</code>が指す要素を削除する。</li>
240240
<li>(2) : <a class="cpprefjp-defined-word" data-desc="2つのイテレータで表現される半開区間を表す。C++20からイテレータと番兵で異なる型であっても指定可能になる">イテレータ範囲</a><code>[first, last)</code>の要素を削除する。</li>
241241
</ul>
242-
<p>もし削除がシーケンスの先頭または末尾から行われた場合、削除された要素へのイテレータと参照は無効化される。もし削除が中間位置から行われた場合、全てのイテレータと削除は無効化される</p>
242+
<p>もし削除がシーケンスの先頭または末尾から行われた場合、削除された要素へのイテレータと参照だけが無効化される(そのほかの要素への参照/イテレータは有効であり続ける)。一方、削除が中間位置から行われた場合は全てのイテレータと参照が無効化される</p>
243243
<h2><a class="cpprefjp-defined-word" data-desc="関数呼び出し式の評価結果となるオブジェクト・値">戻り値</a></h2>
244244
<p>削除された要素の次の要素を指すイテレータを返す。そのような要素が存在しない場合は、<code><a href="end.html">end()</a></code>を返す。さらに、削除された要素以降の要素の数と同じ回数の<code>T</code>のムーブ代入演算子が呼ばれる。</p>
245245
<h2><a class="cpprefjp-defined-word" data-desc="関数等の意味論を構成する要素の1つ。Complexity。関数が使うアルゴリズムの空間計算量・時間計算量">計算量</a></h2>

rss.xml

Lines changed: 29 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,37 @@
22
<feed xmlns="http://www.w3.org/2005/Atom">
33
<title>cpprefjp - C++日本語リファレンス</title>
44
<link href="https://cpprefjp.github.io" />
5-
<updated>2025-07-08T13:36:47.897782</updated>
6-
<id>4ea53472-a487-4a5f-a3fd-53f09d8bc0ed</id>
5+
<updated>2025-07-08T13:53:28.636802</updated>
6+
<id>a6a9c0ba-bfd8-4bca-8623-1a36903edca2</id>
77

88

9+
<entry>
10+
<title>erase -- deque::erase(): イテレータと参照の無効化について微修正</title>
11+
<link href="https://cpprefjp.github.io/reference/deque/deque/erase.html"/>
12+
<id>b7d05c0d904106c98c194f1a9cac27ad71253e8e:reference/deque/deque/erase.md</id>
13+
<updated>2025-07-08T22:49:10+09:00</updated>
14+
15+
<summary type="html">&lt;pre&gt;&lt;code&gt;diff --git a/reference/deque/deque/erase.md b/reference/deque/deque/erase.md
16+
index 303d0facb..8d3174777 100644
17+
--- a/reference/deque/deque/erase.md
18+
+++ b/reference/deque/deque/erase.md
19+
@@ -20,7 +20,7 @@ iterator erase(const_iterator first, const_iterator last); // (2) C++11
20+
- (1) : `position`が指す要素を削除する。
21+
- (2) : イテレータ範囲`[first, last)`の要素を削除する。
22+
23+
-もし削除がシーケンスの先頭または末尾から行われた場合、削除された要素へのイテレータと参照は無効化される。もし削除が中間位置から行われた場合、全てのイテレータと削除は無効化される。
24+
+もし削除がシーケンスの先頭または末尾から行われた場合、削除された要素へのイテレータと参照だけが無効化される(そのほかの要素への参照/イテレータは有効であり続ける)。一方、削除が中間位置から行われた場合は全てのイテレータと参照が無効化される。
25+
26+
27+
## 戻り値
28+
&lt;/code&gt;&lt;/pre&gt;</summary>
29+
30+
<author>
31+
<name>onihusube</name>
32+
<email>[email protected]</email>
33+
</author>
34+
</entry>
35+
936
<entry>
1037
<title>derived_from -- improve std::derived_from</title>
1138
<link href="https://cpprefjp.github.io/reference/concepts/derived_from.html"/>
@@ -474,103 +501,4 @@ index 8d785c808..5ebd2ff78 100644
474501
</author>
475502
</entry>
476503

477-
<entry>
478-
<title>realloc -- new page `cstdlib/realloc`</title>
479-
<link href="https://cpprefjp.github.io/reference/cstdlib/realloc.html"/>
480-
<id>f52245801379796df95cd3829341795846bfd15b:reference/cstdlib/realloc.md</id>
481-
<updated>2025-07-08T19:57:31+09:00</updated>
482-
483-
<summary type="html">&lt;pre&gt;&lt;code&gt;diff --git a/reference/cstdlib/realloc.md b/reference/cstdlib/realloc.md
484-
new file mode 100644
485-
index 000000000..3b807a5b8
486-
--- /dev/null
487-
+++ b/reference/cstdlib/realloc.md
488-
@@ -0,0 +1,79 @@
489-
+# realloc
490-
+* cstdlib[meta header]
491-
+* std[meta namespace]
492-
+* function[meta id-type]
493-
+
494-
+```cpp
495-
+namespace std {
496-
+ void* realloc(void* ptr, size_t new_size);
497-
+}
498-
+```
499-
+
500-
+## 概要
501-
+確保済みの領域`ptr`を`new_size`に再確保する。
502-
+
503-
+`ptr`は、`calloc`、`malloc`、`realloc`で事前に確保され、なおかつ`free`で解放されていないメモリである必要がある。
504-
+
505-
+それ以外のメモリの場合、動作は未定義である。
506-
+
507-
+`ptr`に`nullptr`を渡した場合、`malloc(new_size)`として動作する。
508-
+
509-
+## 効果
510-
+メモリの確保は次のいずれかの方法で行われる。
511-
+
512-
+ - 既存のメモリを拡張、縮小する。
513-
+
514-
+ 縮小した場合、再確保されたメモリのサイズまでの領域の内容が保持される。
515-
+
516-
+ 拡張した場合、新しい領域の内容は未定義である。
517-
+
518-
+ - 新しいサイズの領域を確保、割り当てする。その後、新しいサイズと古いサイズのいずれか小さい方のサイズに等しいメモリ領域をコピーし、古いブロックを解放する。
519-
+
520-
+ - メモリが不足している場合、`nullpte`が返される。
521-
+
522-
+## 備考
523-
+`new_size`が0の場合の動作は定義されていない。
524-
+
525-
+## 戻り値
526-
+再確保できた場合、その領域の先頭のポインタを返す。
527-
+
528-
+なお、その領域はメモリリークを避けるため、`free`、`realloc`で解放する必要がある。
529-
+
530-
+失敗した場合、`nullptr`を返す。もとのポインタは有効なままで、解放する必要がある。
531-
+
532-
+## 例
533-
+```cpp example
534-
+#include &amp;lt;cstdlib&amp;gt;
535-
+#include &amp;lt;iostream&amp;gt;
536-
+
537-
+int main() {
538-
+ // 初期サイズでメモリを確保
539-
+ int* p = static_cast&amp;lt;int*&amp;gt;(std::malloc(5 * sizeof(int)));
540-
+ if (!p) return 1;
541-
+ for (int i = 0; i &amp;lt; 5; ++i) {
542-
+ p[i] = i;
543-
+ }
544-
+ // サイズを再確保(拡張)
545-
+ int* q = static_cast&amp;lt;int*&amp;gt;(std::realloc(p, 10 * sizeof(int)));
546-
+ if (!q) {
547-
+ std::free(p);
548-
+ std::cerr &amp;lt;&amp;lt; &amp;#34;realloc failed&amp;#34; &amp;lt;&amp;lt; std::endl;
549-
+ return 1;
550-
+ }// 拡張後の内容を出力(追加領域の値は未定義)
551-
+ for (int i = 0; i &amp;lt; 10; ++i) {
552-
+ std::cout &amp;lt;&amp;lt; q[i] &amp;lt;&amp;lt; &amp;#39; &amp;#39;;
553-
+ }
554-
+ std::cout &amp;lt;&amp;lt; std::endl;
555-
+ std::free(q);
556-
+}
557-
+```
558-
+## 出力例
559-
+```
560-
+0 1 2 3 4 0 0 0 0 0
561-
+```
562-
+
563-
+
564-
+## 関連項目
565-
+- [`calloc`](calloc.md): メモリを確保する
566-
+- [`malloc`](malloc.md): メモリを確保し、領域をゼロ初期化する
567-
+- [`free`](free.md): 確保したメモリを解放する
568-
&lt;/code&gt;&lt;/pre&gt;</summary>
569-
570-
<author>
571-
<name>K10-K10</name>
572-
<email>[email protected]</email>
573-
</author>
574-
</entry>
575-
576504
</feed>

sitemap.xml

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

57935793
<url>
57945794
<loc>https://cpprefjp.github.io/reference/deque/deque/erase.html</loc>
5795-
<lastmod>2025-07-07T17:11:12+09:00</lastmod>
5795+
<lastmod>2025-07-08T22:49:10+09:00</lastmod>
57965796
<changefreq>daily</changefreq>
57975797
<priority>0.6</priority>
57985798
</url>

0 commit comments

Comments
 (0)