22<feed xmlns="http://www.w3.org/2005/Atom">
33 <title>cpprefjp - C++日本語リファレンス</title>
44 <link href="https://cpprefjp.github.io" />
5- <updated>2025-04-23T04:54:03.242294 </updated>
6- <id>63106600-bbb1-4e8a-a8dd-a740e75af083 </id>
5+ <updated>2025-04-23T05:04:45.036935 </updated>
6+ <id>95c5f72b-37a4-43d0-a18d-aae846d8887c </id>
77
88
99 <entry>
10- <title>double_t -- reference/cmath/double_t .md: New sample program</title>
11- <link href="https://cpprefjp.github.io/reference/cmath/double_t .html"/>
12- <id>dbd3566a381d0bbccd28bfa51211ebeee04a4c5e :reference/cmath/double_t .md</id>
13- <updated>2025-04-23T13:49:45 +09:00</updated>
10+ <title>NULL -- reference/cstddef/null .md: Created sample program</title>
11+ <link href="https://cpprefjp.github.io/reference/cstddef/null .html"/>
12+ <id>06d798bc7c7a4d09d7a907cf3d53d3f63bbd2bf6 :reference/cstddef/null .md</id>
13+ <updated>2025-04-23T14:00:47 +09:00</updated>
1414
15- <summary type="html"><pre><code>diff --git a/reference/cmath/double_t.md b/reference/cmath/double_t.md
16- index 5fecdefac..57ea716c5 100644
17- --- a/reference/cmath/double_t.md
18- +++ b/reference/cmath/double_t.md
19- @@ -15,6 +15,20 @@ namespace std {
15+ <summary type="html"><pre><code>diff --git a/reference/cstddef/null.md b/reference/cstddef/null.md
16+ index 4626fc22b..d7dc7f55f 100644
17+ --- a/reference/cstddef/null.md
18+ +++ b/reference/cstddef/null.md
19+ @@ -20,6 +20,14 @@
20+ - `&lt;ctime&gt;`
21+ - `&lt;cwchar&gt;`
2022
21- [`FLT_EVAL_METHOD`](/reference/cfloat/flt_eval_method.md) が 0 または 1 のとき `double`, 2 のとき `long double`, それ以外の場合は実装依存。
23+ +## 例
24+ +```cpp example
25+ +#include &lt;cstddef&gt;
26+ +int main() {
27+ + int* p = NULL;
28+ + delete p;
29+ +}
30+ +```
2231
23- +## 使用例
32+ ## 備考
33+ C++03において、「ヌルポインタ定数」は「値が0になる整数定数式」と定義されていた。したがって、マクロ`NULL`の値として`0`や`0L`は規格に適合するが、`(void*)0`は整数定数式ではないため適合しない。
34+ </code></pre></summary>
35+
36+ <author>
37+ <name>rotarymars</name>
38+ <email>s.goto2050@gmail.com</email>
39+ </author>
40+ </entry>
41+
42+ <entry>
43+ <title>float_t -- reference/cmath/float_t.md: Created sample program</title>
44+ <link href="https://cpprefjp.github.io/reference/cmath/float_t.html"/>
45+ <id>75705c0f0d110870eb19be7d80a1b0921910a1ef:reference/cmath/float_t.md</id>
46+ <updated>2025-04-23T13:57:13+09:00</updated>
47+
48+ <summary type="html"><pre><code>diff --git a/reference/cmath/float_t.md b/reference/cmath/float_t.md
49+ index 9eb93ac0b..d05aa527b 100644
50+ --- a/reference/cmath/float_t.md
51+ +++ b/reference/cmath/float_t.md
52+ @@ -15,6 +15,19 @@ namespace std {
53+
54+ [`FLT_EVAL_METHOD`](/reference/cfloat/flt_eval_method.md) が 0 のとき `float`, 1 のとき `double`, 2 のとき `long double`, それ以外の場合は実装依存。
55+
56+ +## 例
2457+```cpp example
2558+#include &lt;cmath&gt;
2659+#include &lt;iostream&gt;
2760+int main() {
28- + std::double_t num = 1.00001 ;
61+ + std::float_t num = 1.010 ;
2962+ std::cout &lt;&lt; num &lt;&lt; std::endl;
3063+}
3164+```
32- +
3365+## 出力例
3466+```
35- +1.00001
67+ +1.01
3668+```
3769
3870 ## バージョン
@@ -46,96 +78,36 @@ index 5fecdefac..57ea716c5 100644
4678 </entry>
4779
4880 <entry>
49- <title>契約プログラミング [P2900R14] -- lang/cpp26/contracts .md: Fixed it correctly </title>
50- <link href="https://cpprefjp.github.io/lang/cpp26/contracts .html"/>
51- <id>93cfae5853d0ecb315d930cbecf7845d162b5a3a:lang/cpp26/contracts .md</id>
52- <updated>2025-04-23T12:06:32 +09:00</updated>
81+ <title>double_t -- reference/cmath/double_t .md: New sample program </title>
82+ <link href="https://cpprefjp.github.io/reference/cmath/double_t .html"/>
83+ <id>dbd3566a381d0bbccd28bfa51211ebeee04a4c5e:reference/cmath/double_t .md</id>
84+ <updated>2025-04-23T13:49:45 +09:00</updated>
5385
54- <summary type="html"><pre><code>diff --git a/lang/cpp26/contracts.md b/lang/cpp26/contracts.md
55- index f8af8f946..0d82b64e6 100644
56- --- a/lang/cpp26/contracts.md
57- +++ b/lang/cpp26/contracts.md
58- @@ -17,6 +17,20 @@ C++26では、関数の正確な動作を明示的に指定でき、プログラ
59- この機能は、関数のインターフェースに対する期待値を明確にする役割があり、バグの早期発見、コードの可読性向上に寄与することが期待されている。
60-
61- ## 仕様
62- +### キーワード
63- +`pre`、`post`、`assert`は文脈依存キーワードである。これらは`override`や`final`と同様に、特定の文脈でのみ特別な意味を持つ。
64- +
65- +- 変数名や関数名として使用可能
66- + ```cpp
67- + int pre = 42; // OK: 変数名として使用
68- + void post() {} // OK: 関数名として使用
69- + ```
70- +- 契約指定の文脈でのみ特別な意味を持つ
71- + ```cpp
72- + void f()
73- + pre(true); // ここでは契約指定として機能
74- + ```
75- +
76- ### 契約の種類
77- 契約には以下の3種類が定められている。
86+ <summary type="html"><pre><code>diff --git a/reference/cmath/double_t.md b/reference/cmath/double_t.md
87+ index 5fecdefac..57ea716c5 100644
88+ --- a/reference/cmath/double_t.md
89+ +++ b/reference/cmath/double_t.md
90+ @@ -15,6 +15,20 @@ namespace std {
7891
79- @@ -35,6 +49,24 @@ int safe_division(int numerator, int denominator)
80- ```
81- ここでは、`denominator`が0でないことを事前条件として指定している。
92+ [`FLT_EVAL_METHOD`](/reference/cfloat/flt_eval_method.md) が 0 または 1 のとき `double`, 2 のとき `long double`, それ以外の場合は実装依存。
8293
83- +事前条件では、必ずしも関数のパラメータを使用する必要はない。グローバル状態やクラスのメンバ変数など、呼び出し時点で有効な任意の式を使用できる。
84- +```cpp
85- +class Resource {
86- +private:
87- + bool is_available = false;
88- +public:
89- + void use()
90- + pre(is_available) // 引数を使用していない事前条件
91- + {
92- + // リソースを使用
93- + }
94- +
95- + void activate() {
96- + is_available = true;
97- + }
98- +};
94+ +## 使用例
95+ +```cpp example
96+ +#include &lt;cmath&gt;
97+ +#include &lt;iostream&gt;
98+ +int main() {
99+ + std::double_t num = 1.00001;
100+ + std::cout &lt;&lt; num &lt;&lt; std::endl;
101+ +}
99102+```
100103+
101- #### 事後条件(post)
102- 関数の実行後に満たされているべき条件を指定する。
103- ```cpp
104- @@ -48,6 +80,25 @@ int increment(int x)
105-
106- `post`では、返り値を`r`としてバインドし、条件式内で利用している。ここには、任意の変数名が使用できる。変数は定数(`const`)な左辺値参照である。
107-
108- +事後条件の結果名導入子(result-name-introducer)は省略可能である。特に、`void`を返す関数では、戻り値を参照する必要がない場合に省略できる。
109- +
110- +```cpp
111- +class Container {
112- + // ...
113- +public:
114- + void clear()
115- + post(empty()) // 結果名導入子を省略した事後条件
116- + {
117- + // コンテナの内容をクリア
118- + }
119- +
120- + bool empty() const {
121- + // コンテナが空かどうかを返す
122- + return true;
123- + }
124- +};
104+ +## 出力例
105+ +```
106+ +1.00001
125107+```
126- +
127- #### アサーション(assert)
128- 関数の実行中に満たされているべき条件を指定する。
129- ```cpp
130- @@ -101,7 +152,7 @@ g++ -std=c++26 -fcontracts -fcontract-semantic=observe main.cpp
131- 以下の操作は、気をつけなければならない。
132- - 契約式内において副作用を要する式を記述した場合(グローバル変数の変更、`volatile`変数への参照、`constexpr`でない関数の呼び出しなど)
133- - 契約式内で例外を送出すると、std::terminate()が呼び出され、プログラムが終了する。
134- -- 通常の関数やメンバ関数には契約を適用できるが、特殊な関数(例えば`default`によって定義されたコピーコンストラクタやデストラクタ)には適用できない。適用すると、プログラムは不正(ill-formed)となる。
135- +- 通常の関数やメンバ関数には契約を適用できるが、特殊な関数(例えば`default`によって定義されたコピーコンストラクタやデストラクタ)には適用できない。適用すると、プログラムは不適格(ill-formed)となる。
136108
137- ## &lt;a id=&#34;relative-page&#34; href=&#34;#relative-page&#34;&gt;関連項目&lt;/a&gt;
138- - [C++ 将来 契約に基づくプログラミング](/lang/future/contract-based_programming.md)
109+ ## バージョン
110+ ### 言語
139111</code></pre></summary>
140112
141113 <author>
0 commit comments