|
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>2026-01-05T04:18:03.147567</updated> |
6 | | - <id>b6cc3fed-90db-4418-a62c-3bebdbbb5257</id> |
| 5 | + <updated>2026-01-05T08:21:40.554544</updated> |
| 6 | + <id>659a66c5-8b88-477c-baa1-e89c7eea768e</id> |
7 | 7 |
|
8 | 8 |
|
9 | 9 | <entry> |
@@ -113,113 +113,6 @@ index 8525d9614..c4e11228a 100644 |
113 | 113 |
|
114 | 114 | ## 例 |
115 | 115 |
|
116 | | -</code></pre></summary> |
117 | | - |
118 | | - <author> |
119 | | - <name>Akira Takahashi</name> |
120 | | - |
121 | | - </author> |
122 | | - </entry> |
123 | | - |
124 | | - <entry> |
125 | | - <title>stdexcept -- Merge pull request #1550 from KaiTomotake/add-logic_error</title> |
126 | | - <link href="https://cpprefjp.github.io/reference/stdexcept.html"/> |
127 | | - <id>b43c7b10c14419657757df6a69bd56680e6a0a29:reference/stdexcept.md</id> |
128 | | - <updated>2026-01-05T11:41:30+09:00</updated> |
129 | | - |
130 | | - <summary type="html"><pre><code>diff --git a/reference/stdexcept.md b/reference/stdexcept.md |
131 | | -index 2074a51a5..6a75c204e 100644 |
132 | | ---- a/reference/stdexcept.md |
133 | | -+++ b/reference/stdexcept.md |
134 | | -@@ -13,7 +13,7 @@ |
135 | | - |
136 | | - | 名前 | 説明 | 対応バージョン | |
137 | | - |--------------------|--------------------------------------------|-------| |
138 | | --| `logic_error` | プログラムの実行前に検出可能なエラー(論理エラー)を示す | | |
139 | | -+| [`logic_error`](./stdexcept/logic_error.md) | プログラムの実行前に検出可能なエラー(論理エラー)を示す | | |
140 | | - | `domain_error` | 定義域エラーを示す | | |
141 | | - | `invalid_argument` | 不正な引数を示す | | |
142 | | - | `length_error` | 長すぎるオブジェクトを作ろうとしたことを示す | | |
143 | | -@@ -26,7 +26,7 @@ |
144 | | - 例外クラスには継承関係があり、以下の箇条書きの階層構造で示す。 |
145 | | - |
146 | | - - [`exception`](/reference/exception/exception.md) |
147 | | -- - `logic_error` |
148 | | -+ - [`logic_error`](./stdexcept/logic_error.md) |
149 | | - - `domain_error` |
150 | | - - `invalid_argument` |
151 | | - - `length_error` |
152 | | -</code></pre></summary> |
153 | | - |
154 | | - <author> |
155 | | - <name>Akira Takahashi</name> |
156 | | - |
157 | | - </author> |
158 | | - </entry> |
159 | | - |
160 | | - <entry> |
161 | | - <title>logic_error -- Merge pull request #1550 from KaiTomotake/add-logic_error</title> |
162 | | - <link href="https://cpprefjp.github.io/reference/stdexcept/logic_error.html"/> |
163 | | - <id>b43c7b10c14419657757df6a69bd56680e6a0a29:reference/stdexcept/logic_error.md</id> |
164 | | - <updated>2026-01-05T11:41:30+09:00</updated> |
165 | | - |
166 | | - <summary type="html"><pre><code>diff --git a/reference/stdexcept/logic_error.md b/reference/stdexcept/logic_error.md |
167 | | -new file mode 100644 |
168 | | -index 000000000..8525d9614 |
169 | | ---- /dev/null |
170 | | -+++ b/reference/stdexcept/logic_error.md |
171 | | -@@ -0,0 +1,51 @@ |
172 | | -+# logic_error |
173 | | -+ |
174 | | -+* stdexcept[meta header] |
175 | | -+* class[meta id-type] |
176 | | -+* std[meta namespace] |
177 | | -+ |
178 | | -+```cpp |
179 | | -+namespace std { |
180 | | -+ class logic_error : public exception; |
181 | | -+} |
182 | | -+``` |
183 | | -+ |
184 | | -+## 概要 |
185 | | -+ |
186 | | -+`logic_error`クラスはプログラムの実行前に検出可能なエラー(論理エラー)を通知するためにスローされる例外クラス全般に対する基底クラスである。 |
187 | | -+ |
188 | | -+## メンバ関数 |
189 | | -+ |
190 | | -+| 名前 | 説明 | 対応バージョン | |
191 | | -+| --- | --- | --- | |
192 | | -+| `(constructor)` | コンストラクタ | | |
193 | | -+| `(destructor)` | デストラクタ | | |
194 | | -+| `operator=` | 代入演算子 | | |
195 | | -+| `what` | エラー理由を取得する | | |
196 | | -+ |
197 | | -+## 例 |
198 | | -+ |
199 | | -+```cpp example |
200 | | -+#include &lt;stdexcept&gt; |
201 | | -+#include &lt;iostream&gt; |
202 | | -+ |
203 | | -+int square_root(int num) { |
204 | | -+ if (num &lt; 0) { |
205 | | -+ throw std::invalid_argument(&#34;Cannot perform calculations with negative numbers!&#34;) |
206 | | -+ } |
207 | | -+ return num * num; |
208 | | -+} |
209 | | -+ |
210 | | -+int main() { |
211 | | -+ try { |
212 | | -+ square_root(-5); |
213 | | -+ } catch (const std::logic_error&amp; e) { |
214 | | -+ std::cerr &lt;&lt; &#34;Error: &#34; &lt;&lt; e.what() &lt;&lt; &#34;\n&#34;; |
215 | | -+ } |
216 | | -+} |
217 | | -+``` |
218 | | -+ |
219 | | -+### 出力 |
220 | | -+ |
221 | | -+``` |
222 | | -+``` |
223 | 116 | </code></pre></summary> |
224 | 117 |
|
225 | 118 | <author> |
|
0 commit comments