Skip to content

Commit 8815007

Browse files
author
cpprefjp-autoupdate
committed
update automatically
1 parent 03e4a2f commit 8815007

File tree

3 files changed

+63
-230
lines changed

3 files changed

+63
-230
lines changed

reference/memory/allocator.html

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,8 @@
188188

189189
<p class="text-right"><small>
190190
最終更新日時(UTC):
191-
<span itemprop="datePublished" content="2024-08-05T09:00:59">
192-
2024年08月05日 09時00分59秒
191+
<span itemprop="datePublished" content="2025-05-28T08:09:01">
192+
2025年05月28日 08時09分01秒
193193
</span>
194194
<br/>
195195
<span itemprop="author" itemscope itemtype="http://schema.org/Person">
@@ -357,7 +357,7 @@ <h2>メンバ型</h2>
357357
<tr>
358358
<td><code>is_always_equal</code></td>
359359
<td>同じ型のアロケータオブジェクトが2つある場合、それらが常に同値であるか。<code><a href="../type_traits/true_type.html">true_type</a></code></td>
360-
<td>C++17</td>
360+
<td>C++17<br /> C++20で非推奨<br /> C++26で削除</td>
361361
</tr>
362362
</tbody>
363363
</table>
@@ -406,6 +406,10 @@ <h2>非推奨・削除の詳細</h2>
406406
<li>
407407
<p>メンバ型の<code>size_type</code><code>difference_type</code>は、C++17で非推奨となったがC++20で非推奨が取り消された。</p>
408408
</li>
409+
<li>メンバ型の<code>is_always_equal</code>は、このクラスを継承したメモリアロケータが<code>is_always_equal</code>の値を引き継いでしまうという点で問題があったため、C++20で非推奨となり、C++26で削除された。<ul>
410+
<li>代わりに<code><a href="allocator_traits.html">std::allocator_traits</a></code>クラスの<code>is_always_equal</code>メンバ型を使用すること。</li>
411+
</ul>
412+
</li>
409413
</ul>
410414
<h2></h2>
411415
<p><div class="yata" id="8d8a83928f809f1be090064697a0ca52dea50e79"><div class="codehilite"><pre><span></span><code><span class="cp">#include</span> <span class="cpf"><a href="../memory.html">&lt;memory&gt;</a></span><span class="cp"></span>
@@ -455,6 +459,14 @@ <h2>参照</h2>
455459
<li><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0174r2.html" target="_blank">P0174R2 Deprecating Vestigial Library Parts in C++17</a></li>
456460
<li><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0619r4.html" target="_blank">P0619R4 Reviewing deprecated facilities of C++17 for C++20</a></li>
457461
<li><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4258.pdf" target="_blank">N4258 Cleaning-up noexcept in the Library, Rev 3</a></li>
462+
<li><a href="https://cplusplus.github.io/LWG/issue3170" target="_blank">LWG Issue 3170. <code>is_always_equal</code> added to <code>std::allocator</code> makes the standard library treat derived types as always equal</a><ul>
463+
<li>C++20で<code>is_always_equal</code>メンバ型が非推奨化された</li>
464+
</ul>
465+
</li>
466+
<li><a href="https://open-std.org/jtc1/sc22/wg21/docs/papers/2023/p2868r3.pdf" target="_blank">P2868R3 Remove Deprecated <code>std::allocator</code> Typedef From C++26</a><ul>
467+
<li>C++26で<code>is_always_equal</code>メンバ型が削除された</li>
468+
</ul>
469+
</li>
458470
</ul></div>
459471

460472
</div>

rss.xml

Lines changed: 47 additions & 226 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,55 @@
22
<feed xmlns="http://www.w3.org/2005/Atom">
33
<title>cpprefjp - C++日本語リファレンス</title>
44
<link href="https://cpprefjp.github.io" />
5-
<updated>2025-05-28T05:53:12.456076</updated>
6-
<id>2a530736-59f8-414a-b9d8-fdc077fcf0f8</id>
5+
<updated>2025-05-28T08:12:47.331200</updated>
6+
<id>f937898e-adf5-4853-aff3-775a76ffa979</id>
77

88

9+
<entry>
10+
<title>allocator -- allocator : C++26対応としてis_always_equalを削除 (close #1242)</title>
11+
<link href="https://cpprefjp.github.io/reference/memory/allocator.html"/>
12+
<id>c3e97ea8a80e4a22e82c6b943a35492f2894d99e:reference/memory/allocator.md</id>
13+
<updated>2025-05-28T17:09:01+09:00</updated>
14+
15+
<summary type="html">&lt;pre&gt;&lt;code&gt;diff --git a/reference/memory/allocator.md b/reference/memory/allocator.md
16+
index f38eef148..7d9970fe2 100644
17+
--- a/reference/memory/allocator.md
18+
+++ b/reference/memory/allocator.md
19+
@@ -64,7 +64,7 @@ C++11から:
20+
| `reference` | 要素の参照型 `T&amp;amp;` | C++17から非推奨&amp;lt;br/&amp;gt; C++20で削除 |
21+
| `const_reference` | 読み取り専用の要素の参照型 `const T&amp;amp;` | C++17から非推奨&amp;lt;br/&amp;gt; C++20で削除 |
22+
| `rebind&amp;lt;U&amp;gt;` | 型`U`を確保するように再束縛する | C++17から非推奨&amp;lt;br/&amp;gt; C++20で削除 |
23+
-| `is_always_equal` | 同じ型のアロケータオブジェクトが2つある場合、それらが常に同値であるか。[`true_type`](/reference/type_traits/true_type.md) | C++17 |
24+
+| `is_always_equal` | 同じ型のアロケータオブジェクトが2つある場合、それらが常に同値であるか。[`true_type`](/reference/type_traits/true_type.md) | C++17&amp;lt;br/&amp;gt; C++20で非推奨&amp;lt;br/&amp;gt; C++26で削除 |
25+
26+
27+
## 非メンバ関数
28+
@@ -87,6 +87,9 @@ C++11から:
29+
- なお、プライマリテンプレートからインスタンス化されるようになっても`allocate`/`deallocate`メンバは内部で`sizeof(void)`を要求するため引き続き使用不可能であり、`std::allocator&amp;lt;void&amp;gt;`の使用用途としては従来と同じく再束縛を目的とすることになる(上述のように[`std::allocator_traits`](allocator_traits.md)の代替機能を用いて`typename` [`std::allocator_traits`](allocator_traits.md)`&amp;lt;std::allocator&amp;lt;void&amp;gt;&amp;gt;::template rebind_alloc&amp;lt;R&amp;gt;`のようにする)。
30+
31+
- メンバ型の`size_type`と`difference_type`は、C++17で非推奨となったがC++20で非推奨が取り消された。
32+
+- メンバ型の`is_always_equal`は、このクラスを継承したメモリアロケータが`is_always_equal`の値を引き継いでしまうという点で問題があったため、C++20で非推奨となり、C++26で削除された。
33+
+ - 代わりに[`std::allocator_traits`](allocator_traits.md)クラスの`is_always_equal`メンバ型を使用すること。
34+
+
35+
36+
## 例
37+
```cpp example
38+
@@ -140,3 +143,7 @@ int main(int argc, char** argv) {
39+
- [P0174R2 Deprecating Vestigial Library Parts in C++17](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0174r2.html)
40+
- [P0619R4 Reviewing deprecated facilities of C++17 for C++20](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0619r4.html)
41+
- [N4258 Cleaning-up noexcept in the Library, Rev 3](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4258.pdf)
42+
+- [LWG Issue 3170. `is_always_equal` added to `std::allocator` makes the standard library treat derived types as always equal](https://cplusplus.github.io/LWG/issue3170)
43+
+ - C++20で`is_always_equal`メンバ型が非推奨化された
44+
+- [P2868R3 Remove Deprecated `std::allocator` Typedef From C++26](https://open-std.org/jtc1/sc22/wg21/docs/papers/2023/p2868r3.pdf)
45+
+ - C++26で`is_always_equal`メンバ型が削除された
46+
&lt;/code&gt;&lt;/pre&gt;</summary>
47+
48+
<author>
49+
<name>Akira Takahashi</name>
50+
<email>[email protected]</email>
51+
</author>
52+
</entry>
53+
954
<entry>
1055
<title>projected -- projected : C++26での不完全型への対策に対応 (close #1185)</title>
1156
<link href="https://cpprefjp.github.io/reference/iterator/projected.html"/>
@@ -953,228 +998,4 @@ index 2c418690b..89531d1fd 100644
953998
</author>
954999
</entry>
9551000

956-
<entry>
957-
<title>count -- ranges::count, equal_range, lower_bound : 射影変換の例を追加</title>
958-
<link href="https://cpprefjp.github.io/reference/algorithm/ranges_count.html"/>
959-
<id>1f87d6a9e341dd8e5fe7a0f74d7545a804e9895a:reference/algorithm/ranges_count.md</id>
960-
<updated>2025-05-27T17:23:04+09:00</updated>
961-
962-
<summary type="html">&lt;pre&gt;&lt;code&gt;diff --git a/reference/algorithm/ranges_count.md b/reference/algorithm/ranges_count.md
963-
index 0c3504815..294f0855b 100644
964-
--- a/reference/algorithm/ranges_count.md
965-
+++ b/reference/algorithm/ranges_count.md
966-
@@ -142,6 +142,43 @@ int main() {
967-
count of {1,2}: 2
968-
```
969-
970-
+### 射影変換を使用した例
971-
+```cpp example
972-
+#include &amp;lt;algorithm&amp;gt;
973-
+#include &amp;lt;iostream&amp;gt;
974-
+#include &amp;lt;vector&amp;gt;
975-
+#include &amp;lt;string&amp;gt;
976-
+
977-
+struct Item {
978-
+ int id;
979-
+ std::string label;
980-
+};
981-
+
982-
+int main() {
983-
+ std::vector&amp;lt;Point&amp;gt; v = {
984-
+ {1, &amp;#34;foo&amp;#34;},
985-
+ {3, &amp;#34;bar&amp;#34;},
986-
+ {5, &amp;#34;foo&amp;#34;},
987-
+ {2, &amp;#34;baz&amp;#34;},
988-
+ };
989-
+
990-
+ // メンバ変数ポインタを使って label==&amp;#34;foo&amp;#34; の要素数を数える
991-
+ int n1 = std::ranges::count(v, std::string(&amp;#34;foo&amp;#34;), &amp;amp;Item::label);
992-
+ std::cout &amp;lt;&amp;lt; &amp;#34;count of label==\&amp;#34;foo\&amp;#34;: &amp;#34; &amp;lt;&amp;lt; n1 &amp;lt;&amp;lt; std::endl;
993-
+
994-
+ // ラムダ式を使って id==1 の要素数を数える
995-
+ int n2 = std::ranges::count(v, 1, [](const Item&amp;amp; p) { return p.id; });
996-
+ std::cout &amp;lt;&amp;lt; &amp;#34;count of id==1: &amp;#34; &amp;lt;&amp;lt; n2 &amp;lt;&amp;lt; std::endl;
997-
+}
998-
+```
999-
+* std::ranges::count[color ff0000]
1000-
+
1001-
+#### 出力
1002-
+```
1003-
+count of label==&amp;#34;foo&amp;#34;: 2
1004-
+count of id==1: 2
1005-
+```
1006-
+
1007-
1008-
## 実装例
1009-
```cpp
1010-
&lt;/code&gt;&lt;/pre&gt;</summary>
1011-
1012-
<author>
1013-
<name>Akira Takahashi</name>
1014-
<email>[email protected]</email>
1015-
</author>
1016-
</entry>
1017-
1018-
<entry>
1019-
<title>equal_range -- ranges::count, equal_range, lower_bound : 射影変換の例を追加</title>
1020-
<link href="https://cpprefjp.github.io/reference/algorithm/ranges_equal_range.html"/>
1021-
<id>1f87d6a9e341dd8e5fe7a0f74d7545a804e9895a:reference/algorithm/ranges_equal_range.md</id>
1022-
<updated>2025-05-27T17:23:04+09:00</updated>
1023-
1024-
<summary type="html">&lt;pre&gt;&lt;code&gt;diff --git a/reference/algorithm/ranges_equal_range.md b/reference/algorithm/ranges_equal_range.md
1025-
index 225f563da..fa5266fb4 100644
1026-
--- a/reference/algorithm/ranges_equal_range.md
1027-
+++ b/reference/algorithm/ranges_equal_range.md
1028-
@@ -182,6 +182,62 @@ int main() {
1029-
3,4
1030-
```
1031-
1032-
+### 射影変換を使用した例
1033-
+```cpp example
1034-
+#include &amp;lt;iostream&amp;gt;
1035-
+#include &amp;lt;vector&amp;gt;
1036-
+#include &amp;lt;algorithm&amp;gt;
1037-
+#include &amp;lt;string&amp;gt;
1038-
+
1039-
+struct X {
1040-
+ int id;
1041-
+ std::string name;
1042-
+};
1043-
+
1044-
+int main() {
1045-
+ std::vector&amp;lt;X&amp;gt; v = {
1046-
+ {1, &amp;#34;Carol&amp;#34;},
1047-
+ {3, &amp;#34;Alice&amp;#34;},
1048-
+ {4, &amp;#34;Bob&amp;#34;},
1049-
+ {4, &amp;#34;Bob&amp;#34;},
1050-
+ {5, &amp;#34;Eve&amp;#34;},
1051-
+ {6, &amp;#34;Dave&amp;#34;}
1052-
+ };
1053-
+ const std::string key = &amp;#34;Bob&amp;#34;;
1054-
+
1055-
+ // メンバ変数nameをキーとして検索
1056-
+ // 1. メンバ変数ポインタを使う方法
1057-
+ auto result1 = std::ranges::equal_range(v, key, {}, &amp;amp;X::name);
1058-
+ std::cout &amp;lt;&amp;lt; &amp;#34;[メンバ変数ポインタ]&amp;#34; &amp;lt;&amp;lt; std::endl;
1059-
+ for (const X&amp;amp; x : result1) {
1060-
+ std::cout &amp;lt;&amp;lt; &amp;#34;id=&amp;#34; &amp;lt;&amp;lt; x.id &amp;lt;&amp;lt; &amp;#34; name=&amp;#34; &amp;lt;&amp;lt; x.name &amp;lt;&amp;lt; std::endl;
1061-
+ }
1062-
+
1063-
+ // 2. ラムダ式を使う方法
1064-
+ auto result2 = std::ranges::equal_range(
1065-
+ v,
1066-
+ key,
1067-
+ {},
1068-
+ [](const X&amp;amp; x) { return x.name; }
1069-
+);
1070-
+ std::cout &amp;lt;&amp;lt; &amp;#34;[ラムダ式]&amp;#34; &amp;lt;&amp;lt; std::endl;
1071-
+ for (const X&amp;amp; x : result2) {
1072-
+ std::cout &amp;lt;&amp;lt; &amp;#34;id=&amp;#34; &amp;lt;&amp;lt; x.id &amp;lt;&amp;lt; &amp;#34; name=&amp;#34; &amp;lt;&amp;lt; x.name &amp;lt;&amp;lt; std::endl;
1073-
+ }
1074-
+}
1075-
+```
1076-
+* std::ranges::equal_range[color ff0000]
1077-
+
1078-
+#### 出力
1079-
+```
1080-
+[メンバ変数ポインタ]
1081-
+id=4 name=Bob
1082-
+id=4 name=Bob
1083-
+[ラムダ式]
1084-
+id=4 name=Bob
1085-
+id=4 name=Bob
1086-
+```
1087-
+
1088-
## バージョン
1089-
### 言語
1090-
- C++20
1091-
&lt;/code&gt;&lt;/pre&gt;</summary>
1092-
1093-
<author>
1094-
<name>Akira Takahashi</name>
1095-
<email>[email protected]</email>
1096-
</author>
1097-
</entry>
1098-
1099-
<entry>
1100-
<title>lower_bound -- ranges::count, equal_range, lower_bound : 射影変換の例を追加</title>
1101-
<link href="https://cpprefjp.github.io/reference/algorithm/ranges_lower_bound.html"/>
1102-
<id>1f87d6a9e341dd8e5fe7a0f74d7545a804e9895a:reference/algorithm/ranges_lower_bound.md</id>
1103-
<updated>2025-05-27T17:23:04+09:00</updated>
1104-
1105-
<summary type="html">&lt;pre&gt;&lt;code&gt;diff --git a/reference/algorithm/ranges_lower_bound.md b/reference/algorithm/ranges_lower_bound.md
1106-
index 9fb2c5659..9b4d1be4f 100644
1107-
--- a/reference/algorithm/ranges_lower_bound.md
1108-
+++ b/reference/algorithm/ranges_lower_bound.md
1109-
@@ -230,6 +230,62 @@ int main() {
1110-
pos=2
1111-
```
1112-
1113-
+### 射影変換を使用した例
1114-
+```cpp example
1115-
+#include &amp;lt;iostream&amp;gt;
1116-
+#include &amp;lt;algorithm&amp;gt;
1117-
+#include &amp;lt;vector&amp;gt;
1118-
+#include &amp;lt;string&amp;gt;
1119-
+
1120-
+struct X {
1121-
+ int id;
1122-
+ std::string name;
1123-
+};
1124-
+
1125-
+int main() {
1126-
+ std::vector&amp;lt;X&amp;gt; v = {
1127-
+ {1, &amp;#34;Carol&amp;#34;},
1128-
+ {3, &amp;#34;Alice&amp;#34;},
1129-
+ {4, &amp;#34;Bob&amp;#34;},
1130-
+ {5, &amp;#34;Eve&amp;#34;},
1131-
+ {6, &amp;#34;Dave&amp;#34;}
1132-
+ };
1133-
+ const std::string key = &amp;#34;Bob&amp;#34;;
1134-
+
1135-
+ // nameメンバ変数をキーとして検索
1136-
+ // 1. メンバ変数ポインタを使う方法
1137-
+ auto it1 = std::ranges::lower_bound(v, key, {}, &amp;amp;X::name);
1138-
+ if (it1 != v.end() &amp;amp;&amp;amp; it1-&amp;gt;name == key) {
1139-
+ std::size_t pos = std::ranges::distance(v.begin(), it1);
1140-
+ std::cout &amp;lt;&amp;lt; &amp;#34;id=&amp;#34; &amp;lt;&amp;lt; it1-&amp;gt;id
1141-
+ &amp;lt;&amp;lt; &amp;#34; name=&amp;#34; &amp;lt;&amp;lt; it1-&amp;gt;name
1142-
+ &amp;lt;&amp;lt; &amp;#34; pos=&amp;#34; &amp;lt;&amp;lt; pos &amp;lt;&amp;lt; std::endl;
1143-
+ }
1144-
+
1145-
+ // 2. ラムダ式を使う方法
1146-
+ auto it2 = std::ranges::lower_bound(
1147-
+ v,
1148-
+ key,
1149-
+ {},
1150-
+ [](const X&amp;amp; x) { return x.name; }
1151-
+ );
1152-
+ if (it2 != v.end() &amp;amp;&amp;amp; it2-&amp;gt;name == key) {
1153-
+ std::size_t pos = std::ranges::distance(v.begin(), it2);
1154-
+ std::cout &amp;lt;&amp;lt; &amp;#34;id=&amp;#34; &amp;lt;&amp;lt; it2-&amp;gt;id
1155-
+ &amp;lt;&amp;lt; &amp;#34; name=&amp;#34; &amp;lt;&amp;lt; it2-&amp;gt;name
1156-
+ &amp;lt;&amp;lt; &amp;#34; pos=&amp;#34; &amp;lt;&amp;lt; pos &amp;lt;&amp;lt; std::endl;
1157-
+ }
1158-
+}
1159-
+```
1160-
+* std::ranges::lower_bound[color ff0000]
1161-
+* std::ranges::distance[link /reference/iterator/ranges_distance.md]
1162-
+
1163-
+#### 出力
1164-
+```
1165-
+id=4 name=Bob pos=2
1166-
+id=4 name=Bob pos=2
1167-
+```
1168-
+
1169-
## バージョン
1170-
### 言語
1171-
- C++20
1172-
&lt;/code&gt;&lt;/pre&gt;</summary>
1173-
1174-
<author>
1175-
<name>Akira Takahashi</name>
1176-
<email>[email protected]</email>
1177-
</author>
1178-
</entry>
1179-
11801001
</feed>

sitemap.xml

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

83278327
<url>
83288328
<loc>https://cpprefjp.github.io/reference/memory/allocator.html</loc>
8329-
<lastmod>2025-04-03T12:32:11+09:00</lastmod>
8329+
<lastmod>2025-05-28T17:09:01+09:00</lastmod>
83308330
<changefreq>daily</changefreq>
83318331
<priority>0.7</priority>
83328332
</url>

0 commit comments

Comments
 (0)