Skip to content

Commit 249f282

Browse files
author
cpprefjp-autoupdate
committed
update automatically
1 parent cd79256 commit 249f282

File tree

6 files changed

+101
-2117
lines changed

6 files changed

+101
-2117
lines changed

reference/memory_resource/polymorphic_allocator.html

Lines changed: 3 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-06-11T13:45:38">
192-
2024年06月11日 13時45分38秒
191+
<span itemprop="datePublished" content="2024-08-09T04:35:29">
192+
2024年08月09日 04時35分29秒
193193
</span>
194194
<br/>
195195
<span itemprop="author" itemscope itemtype="http://schema.org/Person">
@@ -309,7 +309,7 @@ <h3>オブジェクト構築・破棄を行う関数</h3>
309309
<tr>
310310
<td><code><a href="polymorphic_allocator/destroy.html">destroy</a></code></td>
311311
<td>指定された領域のオブジェクトを破棄する</td>
312-
<td>C++17<br />C++20より非推奨</td>
312+
<td>C++17</td>
313313
</tr>
314314
<tr>
315315
<td><code><a href="polymorphic_allocator/new_object.html">new_object</a></code></td>

reference/memory_resource/polymorphic_allocator/destroy.html

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868

6969
</head>
7070
<body>
71-
<header data-kunai-mdinfo="{&#34;meta&#34;: {&#34;header&#34;: [&#34;memory_resource&#34;], &#34;id-type&#34;: [&#34;function template&#34;], &#34;namespace&#34;: [&#34;std::pmr&#34;], &#34;class&#34;: [&#34;polymorphic_allocator&#34;], &#34;cpp&#34;: [&#34;cpp17&#34;, &#34;cpp20deprecated&#34;]}, &#34;sources&#34;: [{&#34;id&#34;: &#34;15c857b0f08a6f1d15801e735e7cd78e891400c2&#34;, &#34;source&#34;: &#34;#include &lt;iostream&gt;\n#include &lt;memory_resource&gt;\n\nint main()\n{\n std::pmr::polymorphic_allocator&lt;int&gt; alloc{};\n\n //\u30e1\u30e2\u30ea\u306e\u78ba\u4fdd\n int* array = alloc.allocate(4);\n\n //\u8981\u7d20\u3092\u69cb\u7bc9\n for (int i = 0; i &lt; 4; ++i) {\n alloc.construct(array + i, i);\n }\n\n for (int i = 0; i &lt; 4; ++i) {\n std::cout &lt;&lt; array[i] &lt;&lt; std::endl;\n }\n\n //\u8981\u7d20\u3092\u7834\u68c4\n for (int i = 0; i &lt; 4; ++i) {\n alloc.destroy(array + i);\n }\n\n //\u30e1\u30e2\u30ea\u306e\u89e3\u653e\n alloc.deallocate(array, 4);\n}\n&#34;}], &#34;page_id&#34;: [&#34;reference&#34;, &#34;memory_resource&#34;, &#34;polymorphic_allocator&#34;, &#34;destroy&#34;]}">
71+
<header data-kunai-mdinfo="{&#34;meta&#34;: {&#34;header&#34;: [&#34;memory_resource&#34;], &#34;id-type&#34;: [&#34;function template&#34;], &#34;namespace&#34;: [&#34;std::pmr&#34;], &#34;class&#34;: [&#34;polymorphic_allocator&#34;], &#34;cpp&#34;: [&#34;cpp17&#34;]}, &#34;sources&#34;: [{&#34;id&#34;: &#34;15c857b0f08a6f1d15801e735e7cd78e891400c2&#34;, &#34;source&#34;: &#34;#include &lt;iostream&gt;\n#include &lt;memory_resource&gt;\n\nint main()\n{\n std::pmr::polymorphic_allocator&lt;int&gt; alloc{};\n\n //\u30e1\u30e2\u30ea\u306e\u78ba\u4fdd\n int* array = alloc.allocate(4);\n\n //\u8981\u7d20\u3092\u69cb\u7bc9\n for (int i = 0; i &lt; 4; ++i) {\n alloc.construct(array + i, i);\n }\n\n for (int i = 0; i &lt; 4; ++i) {\n std::cout &lt;&lt; array[i] &lt;&lt; std::endl;\n }\n\n //\u8981\u7d20\u3092\u7834\u68c4\n for (int i = 0; i &lt; 4; ++i) {\n alloc.destroy(array + i);\n }\n\n //\u30e1\u30e2\u30ea\u306e\u89e3\u653e\n alloc.deallocate(array, 4);\n}\n&#34;}], &#34;page_id&#34;: [&#34;reference&#34;, &#34;memory_resource&#34;, &#34;polymorphic_allocator&#34;, &#34;destroy&#34;]}">
7272
<nav class="navbar navbar-default" role="navigation">
7373
<div class="container-fluid">
7474
<div class="navbar-header">
@@ -200,8 +200,8 @@
200200

201201
<p class="text-right"><small>
202202
最終更新日時(UTC):
203-
<span itemprop="datePublished" content="2024-06-11T13:45:38">
204-
2024年06月11日 13時45分38秒
203+
<span itemprop="datePublished" content="2024-08-09T04:35:29">
204+
2024年08月09日 04時35分29秒
205205
</span>
206206
<br/>
207207
<span itemprop="author" itemscope itemtype="http://schema.org/Person">
@@ -224,12 +224,11 @@
224224
<div class="row">
225225
<div class="col-sm-12 content-body">
226226

227-
<div class="identifier-type">function template</div><div class="header">&lt;memory_resource&gt;</div><h1 itemprop="name"><span class="namespace" title="namespace std::pmr">std::pmr::</span><span class="class" title="class polymorphic_allocator">polymorphic_allocator::</span><span class="token">destroy</span><span class="cpp cpp17" title="C++17で追加">(C++17)</span><span class="cpp cpp20deprecated text-warning" title="C++20で非推奨">(C++20で非推奨)</span></h1>
227+
<div class="identifier-type">function template</div><div class="header">&lt;memory_resource&gt;</div><h1 itemprop="name"><span class="namespace" title="namespace std::pmr">std::pmr::</span><span class="class" title="class polymorphic_allocator">polymorphic_allocator::</span><span class="token">destroy</span><span class="cpp cpp17" title="C++17で追加">(C++17)</span></h1>
228228
<div itemprop="articleBody"><p><div class="codehilite"><pre><span></span><code><span class="k">template</span> <span class="o">&lt;</span><span class="k">class</span> <span class="nc">T</span><span class="o">&gt;</span>
229229
<span class="kt">void</span> <span class="n">destroy</span><span class="p">(</span><span class="n">T</span><span class="o">*</span> <span class="n">p</span><span class="p">);</span>
230230
</code></pre></div>
231231
</p>
232-
<p>この関数はC++20で非推奨となった。不要な機能ではあるが、代わりが必要であれば<code><a href="../../memory/allocator_traits/destroy.html">allocator_traits&lt;Alloc&gt;::destroy()</a></code>もしくは<code><a href="../../memory/destroy_at.html">destroy_at()</a></code>を使用すること。</p>
233232
<h2>概要</h2>
234233
<p>指定された領域にある<code>T</code>のオブジェクトを破棄する。</p>
235234
<h2>引数</h2>
@@ -239,11 +238,6 @@ <h2>引数</h2>
239238
<h2>効果</h2>
240239
<p>あたかも<code>p-&gt;~T()</code>を実行したように、<code>p</code>の指す<code>T</code>のオブジェクトを破棄する。</p>
241240
<p>メモリ領域の解放は行われないため、別に<code><a href="deallocate.html">deallocate</a></code>で行う必要がある。</p>
242-
<h2>非推奨の詳細</h2>
243-
<p><code>polymorphic_allocator</code>も含めたアロケータはコンテナから利用される際に<code>allocator_traits</code>を介して利用され、<code>allocator_traits</code>の提供するデフォルト実装によってアロケータとしての多くの部分が補われる。</p>
244-
<p>本関数は、<code><a href="../../memory/allocator_traits/destroy.html">allocator_traits&lt;Alloc&gt;::destroy()</a></code>で提供されているデフォルト実装と完全に同一の実装となっており、追加の事を何もしていない。従って有用性は何もなく、非推奨とされた。</p>
245-
<p>おそらく、<code><a href="construct.html">construct()</a></code>メンバ関数との対称性を意識して追加されていたものと思われる。なお、<code>construct()</code>メンバ関数は<a href="../../memory/uses_allocator.html">uses-allocator 構築</a>のために追加の仕事を担っており、こちらの関数には有用であるため非推奨とはされていない。</p>
246-
<p><code>allocator_traits</code>を介して<code>polymorphic_allocator</code>を使用する場合は本関数の有無を気にする必要はないが、もし本関数が必要となった場合は代わりに<code><a href="../../memory/destroy_at.html">destroy_at()</a></code>を利用できる。</p>
247241
<h2></h2>
248242
<p><div class="yata" id="15c857b0f08a6f1d15801e735e7cd78e891400c2"><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>
249243
<span class="cp">#include</span> <span class="cpf"><a href="../../memory_resource.html">&lt;memory_resource&gt;</a></span><span class="cp"></span>
@@ -306,6 +300,10 @@ <h2>参照</h2>
306300
<li><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4562.html#memory.resource.synop" target="_blank">Working Draft, C++ Extensions for Library Fundamentals, Version 2</a></li>
307301
<li><a href="https://developercommunity.visualstudio.com/content/problem/394908/destroy-missing-member-function-of-stdpmrpolymorph.html" target="_blank">destroy: Missing member function of std::pmr::polymorphic_allocator - Developer Community</a></li>
308302
<li><a href="https://cplusplus.github.io/LWG/issue3036" target="_blank">LWG Issue 3036. <code>polymorphic_allocator::destroy</code> is extraneous</a></li>
303+
<li><a href="https://open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2875r4.pdf" target="_blank">P2875R4 Undeprecate <code>polymorphic_allocator::destroy</code> for C++26</a><ul>
304+
<li>この関数はC++20で一度非推奨となったが、C++26で非推奨が取り消された。ただし、<code><a href="../../memory/allocator_traits/destroy.html">allocator_traits&lt;Alloc&gt;::destroy()</a></code>関数や<code><a href="../../memory/destroy_at.html">destroy_at()</a></code>関数で同等のことができる</li>
305+
</ul>
306+
</li>
309307
</ul></div>
310308

311309
</div>

0 commit comments

Comments
 (0)