1 Star 0 Fork 0

mobangjack / memory

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
classfoonathan_1_1memory_1_1memory__pool__collection.html 40.27 KB
一键复制 编辑 原始数据 按行查看 历史
Jonathan Müller 提交于 2020-05-05 17:04 . Update documentation
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689
<!-- HTML header for doxygen 1.8.16-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.18"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>memory: memory_pool_collection&lt; PoolType, BucketDistribution, BlockOrRawAllocator &gt; Class Template Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">memory
</div>
</td>
</tr>
</tbody>
</table>
</div>
<div id="main-nav">
<ul class="sm sm-dox" id="main-menu">
<li><a href="index.html">Main Page</a></li>
<li><a href="md_doc_tutorial.html">Tutorial</a></li>
<li><a href="namespacefoonathan_1_1memory.html">Index</a></li>
<li><a href="files.html">Files</a></li>
</ul>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.18 -->
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="namespacefoonathan.html">foonathan</a></li><li class="navelem"><a class="el" href="namespacefoonathan_1_1memory.html">memory</a></li><li class="navelem"><a class="el" href="classfoonathan_1_1memory_1_1memory__pool__collection.html">memory_pool_collection</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#pub-types">Typedefs</a> &#124;
<a href="#pub-methods">Member Functions</a> </div>
<div class="headertitle">
<div class="title">memory_pool_collection&lt; PoolType, BucketDistribution, BlockOrRawAllocator &gt; Class Template Reference<div class="ingroups"><a class="el" href="group__allocator.html">Allocator implementations</a></div></div> </div>
</div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><h3>template&lt;class PoolType, class BucketDistribution, class BlockOrRawAllocator = default_allocator&gt;<br />
class foonathan::memory::memory_pool_collection&lt; PoolType, BucketDistribution, BlockOrRawAllocator &gt;</h3>
<p>A stateful <a href="md_doc_concepts.html#concept_rawallocator">RawAllocator</a> that behaves as a collection of multiple <a class="el" href="classfoonathan_1_1memory_1_1memory__pool.html">memory_pool</a> objects. </p>
<p>It maintains a list of multiple free lists, whose types are controlled via the <code>PoolType</code> tags defined in <a class="el" href="memory__pool__type_8hpp.html">memory_pool_type.hpp</a>, each of a different size as defined in the <code>BucketDistribution</code> (<a class="el" href="structfoonathan_1_1memory_1_1identity__buckets.html">identity_buckets</a> or <a class="el" href="structfoonathan_1_1memory_1_1log2__buckets.html">log2_buckets</a>). Allocating a node of given size will use the appropriate free list.<br />
This allocator is ideal for <a href="md_doc_concepts.html#concept_node">node</a> allocations in any order but with a predefined set of sizes, not only one size like <a class="el" href="classfoonathan_1_1memory_1_1memory__pool.html">memory_pool</a>. </p>
</div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-types"></a>
Typedefs</h2></td></tr>
<tr class="memitem:a7fd26a8539389ffa2a4b1d1a7b6b839c"><td class="memItemLeft" align="right" valign="top"><a id="a7fd26a8539389ffa2a4b1d1a7b6b839c"></a>
using&#160;</td><td class="memItemRight" valign="bottom"><b>allocator_type</b> = <a class="el" href="group__core.html#gaf1ce941b1306a592d4ebba1167fd98aa">make_block_allocator_t</a>&lt; BlockOrRawAllocator &gt;</td></tr>
<tr class="separator:a7fd26a8539389ffa2a4b1d1a7b6b839c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a57a387e63de9c0ba78a5f77675ff8eed"><td class="memItemLeft" align="right" valign="top"><a id="a57a387e63de9c0ba78a5f77675ff8eed"></a>
using&#160;</td><td class="memItemRight" valign="bottom"><b>pool_type</b> = PoolType</td></tr>
<tr class="separator:a57a387e63de9c0ba78a5f77675ff8eed"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a61d55454c8b83335e6b2d4704f67d35b"><td class="memItemLeft" align="right" valign="top"><a id="a61d55454c8b83335e6b2d4704f67d35b"></a>
using&#160;</td><td class="memItemRight" valign="bottom"><b>bucket_distribution</b> = BucketDistribution</td></tr>
<tr class="separator:a61d55454c8b83335e6b2d4704f67d35b"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Member Functions</h2></td></tr>
<tr class="memitem:a86d4ccd7b3f2d5e1974ef81d4d6f9782"><td class="memTemplParams" colspan="2">template&lt;typename... Args&gt; </td></tr>
<tr class="memitem:a86d4ccd7b3f2d5e1974ef81d4d6f9782"><td class="memTemplItemLeft" align="right" valign="top">&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classfoonathan_1_1memory_1_1memory__pool__collection.html#a86d4ccd7b3f2d5e1974ef81d4d6f9782">memory_pool_collection</a> (std::size_t <a class="el" href="classfoonathan_1_1memory_1_1memory__pool__collection.html#acaa832c9a7c293c443582bce418e6ff7">max_node_size</a>, std::size_t block_size, Args &amp;&amp;... args)</td></tr>
<tr class="separator:a86d4ccd7b3f2d5e1974ef81d4d6f9782"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a677c0db5774ea64c167ef8e915f20b46"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classfoonathan_1_1memory_1_1memory__pool__collection.html#a677c0db5774ea64c167ef8e915f20b46">~memory_pool_collection</a> () noexcept=default</td></tr>
<tr class="separator:a677c0db5774ea64c167ef8e915f20b46"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:acdb51b626fa21c10ea5e7ff7e0f767b7"><td class="memItemLeft" align="right" valign="top">void *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classfoonathan_1_1memory_1_1memory__pool__collection.html#acdb51b626fa21c10ea5e7ff7e0f767b7">allocate_node</a> (std::size_t node_size)</td></tr>
<tr class="separator:acdb51b626fa21c10ea5e7ff7e0f767b7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9d803fa2333bca801c80f1dd49b1919b"><td class="memItemLeft" align="right" valign="top">void *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classfoonathan_1_1memory_1_1memory__pool__collection.html#a9d803fa2333bca801c80f1dd49b1919b">try_allocate_node</a> (std::size_t node_size) noexcept</td></tr>
<tr class="separator:a9d803fa2333bca801c80f1dd49b1919b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a720a69b26898e57f8ae02719ef396126"><td class="memItemLeft" align="right" valign="top">void *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classfoonathan_1_1memory_1_1memory__pool__collection.html#a720a69b26898e57f8ae02719ef396126">allocate_array</a> (std::size_t count, std::size_t node_size)</td></tr>
<tr class="separator:a720a69b26898e57f8ae02719ef396126"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a49e5dcf97500c79bde4841307f3800bd"><td class="memItemLeft" align="right" valign="top">void *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classfoonathan_1_1memory_1_1memory__pool__collection.html#a49e5dcf97500c79bde4841307f3800bd">try_allocate_array</a> (std::size_t count, std::size_t node_size) noexcept</td></tr>
<tr class="separator:a49e5dcf97500c79bde4841307f3800bd"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:abea27e87dff3fd937c27956280ffa723"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classfoonathan_1_1memory_1_1memory__pool__collection.html#abea27e87dff3fd937c27956280ffa723">deallocate_node</a> (void *ptr, std::size_t node_size) noexcept</td></tr>
<tr class="separator:abea27e87dff3fd937c27956280ffa723"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a45aa533ff359590cafe8029be35e7b58"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classfoonathan_1_1memory_1_1memory__pool__collection.html#a45aa533ff359590cafe8029be35e7b58">try_deallocate_node</a> (void *ptr, std::size_t node_size) noexcept</td></tr>
<tr class="separator:a45aa533ff359590cafe8029be35e7b58"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ade8b16f2361fbc3bc38405142edcad37"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classfoonathan_1_1memory_1_1memory__pool__collection.html#ade8b16f2361fbc3bc38405142edcad37">deallocate_array</a> (void *ptr, std::size_t count, std::size_t node_size) noexcept</td></tr>
<tr class="separator:ade8b16f2361fbc3bc38405142edcad37"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0e5b9ad4ae5cbbcb262f329ab902badb"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classfoonathan_1_1memory_1_1memory__pool__collection.html#a0e5b9ad4ae5cbbcb262f329ab902badb">try_deallocate_array</a> (void *ptr, std::size_t count, std::size_t node_size) noexcept</td></tr>
<tr class="separator:a0e5b9ad4ae5cbbcb262f329ab902badb"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a053249e1f3314b2769617d17f3c0aef3"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classfoonathan_1_1memory_1_1memory__pool__collection.html#a053249e1f3314b2769617d17f3c0aef3">reserve</a> (std::size_t node_size, std::size_t capacity)</td></tr>
<tr class="separator:a053249e1f3314b2769617d17f3c0aef3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:acaa832c9a7c293c443582bce418e6ff7"><td class="memItemLeft" align="right" valign="top">std::size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classfoonathan_1_1memory_1_1memory__pool__collection.html#acaa832c9a7c293c443582bce418e6ff7">max_node_size</a> () const noexcept</td></tr>
<tr class="separator:acaa832c9a7c293c443582bce418e6ff7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab8a5ee2f65b4927734c4bb5f06c8aec3"><td class="memItemLeft" align="right" valign="top">std::size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classfoonathan_1_1memory_1_1memory__pool__collection.html#ab8a5ee2f65b4927734c4bb5f06c8aec3">pool_capacity_left</a> (std::size_t node_size) const noexcept</td></tr>
<tr class="separator:ab8a5ee2f65b4927734c4bb5f06c8aec3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a97da77ca5a46e5e3088d6c0637b52af7"><td class="memItemLeft" align="right" valign="top">std::size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classfoonathan_1_1memory_1_1memory__pool__collection.html#a97da77ca5a46e5e3088d6c0637b52af7">capacity_left</a> () const noexcept</td></tr>
<tr class="separator:a97da77ca5a46e5e3088d6c0637b52af7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af4fe037332aabd13253517d22394da73"><td class="memItemLeft" align="right" valign="top">std::size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classfoonathan_1_1memory_1_1memory__pool__collection.html#af4fe037332aabd13253517d22394da73">next_capacity</a> () const noexcept</td></tr>
<tr class="separator:af4fe037332aabd13253517d22394da73"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3ae445687ecb4a037b542ede5c6f48ac"><td class="memItemLeft" align="right" valign="top">allocator_type &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classfoonathan_1_1memory_1_1memory__pool__collection.html#a3ae445687ecb4a037b542ede5c6f48ac">get_allocator</a> () noexcept</td></tr>
<tr class="separator:a3ae445687ecb4a037b542ede5c6f48ac"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr><td colspan="2"><div class="groupHeader"></div></td></tr>
<tr class="memitem:a45c87c6947bee01ef50fa6f80edb4c09"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classfoonathan_1_1memory_1_1memory__pool__collection.html#a45c87c6947bee01ef50fa6f80edb4c09">memory_pool_collection</a> (<a class="el" href="classfoonathan_1_1memory_1_1memory__pool__collection.html">memory_pool_collection</a> &amp;&amp;other) noexcept</td></tr>
<tr class="separator:a45c87c6947bee01ef50fa6f80edb4c09"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4bded501bb1b352d17c10ee84d790337"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classfoonathan_1_1memory_1_1memory__pool__collection.html">memory_pool_collection</a> &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classfoonathan_1_1memory_1_1memory__pool__collection.html#a4bded501bb1b352d17c10ee84d790337">operator=</a> (<a class="el" href="classfoonathan_1_1memory_1_1memory__pool__collection.html">memory_pool_collection</a> &amp;&amp;other) noexcept</td></tr>
<tr class="separator:a4bded501bb1b352d17c10ee84d790337"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Constructors</h2>
<a id="a86d4ccd7b3f2d5e1974ef81d4d6f9782"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a86d4ccd7b3f2d5e1974ef81d4d6f9782">&#9670;&nbsp;</a></span>memory_pool_collection() <span class="overload">[1/2]</span></h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classfoonathan_1_1memory_1_1memory__pool__collection.html">memory_pool_collection</a> </td>
<td>(</td>
<td class="paramtype">std::size_t&#160;</td>
<td class="paramname"><em>max_node_size</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">std::size_t&#160;</td>
<td class="paramname"><em>block_size</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">Args &amp;&amp;...&#160;</td>
<td class="paramname"><em>args</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<dl class="section user"><dt>Effects:</dt><dd>Creates it by giving it the maximum node size it should be able to allocate, the size of the initial memory block and other constructor arguments for the <a href="md_doc_concepts.html#concept_blockallocator">BlockAllocator</a>. The <code>BucketDistribution</code> controls how many free lists are created, but unlike in <a class="el" href="classfoonathan_1_1memory_1_1memory__pool.html">memory_pool</a> all free lists are initially empty and the first memory block queued. </dd></dl>
<dl class="section user"><dt>Requires:</dt><dd><code>max_node_size</code> must be a valid <a href="md_doc_concepts.html#concept_node">node</a> size and <code>block_size</code> must be non-zero. </dd></dl>
</div>
</div>
<a id="a677c0db5774ea64c167ef8e915f20b46"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a677c0db5774ea64c167ef8e915f20b46">&#9670;&nbsp;</a></span>~memory_pool_collection()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">~<a class="el" href="classfoonathan_1_1memory_1_1memory__pool__collection.html">memory_pool_collection</a> </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">default</span><span class="mlabel">noexcept</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<dl class="section user"><dt>Effects:</dt><dd>Destroys the <a class="el" href="classfoonathan_1_1memory_1_1memory__pool__collection.html">memory_pool_collection</a> by returning all memory blocks, regardless of properly deallocated back to the <a href="md_doc_concepts.html#concept_blockallocator">BlockAllocator</a>. </dd></dl>
</div>
</div>
<a id="a45c87c6947bee01ef50fa6f80edb4c09"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a45c87c6947bee01ef50fa6f80edb4c09">&#9670;&nbsp;</a></span>memory_pool_collection() <span class="overload">[2/2]</span></h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classfoonathan_1_1memory_1_1memory__pool__collection.html">memory_pool_collection</a> </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classfoonathan_1_1memory_1_1memory__pool__collection.html">memory_pool_collection</a>&lt; PoolType, BucketDistribution, BlockOrRawAllocator &gt; &amp;&amp;&#160;</td>
<td class="paramname"><em>other</em></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">noexcept</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<dl class="section user"><dt>Effects:</dt><dd>Moving a <a class="el" href="classfoonathan_1_1memory_1_1memory__pool__collection.html">memory_pool_collection</a> object transfers ownership over the free lists, i.e. the moved from pool is completely empty and the new one has all its memory. That means that it is not allowed to call <a class="el" href="classfoonathan_1_1memory_1_1memory__pool__collection.html#abea27e87dff3fd937c27956280ffa723">deallocate_node()</a> on a moved-from allocator even when passing it memory that was previously allocated by this object. </dd></dl>
</div>
</div>
<h2 class="groupheader">Member Functions</h2>
<a id="a4bded501bb1b352d17c10ee84d790337"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a4bded501bb1b352d17c10ee84d790337">&#9670;&nbsp;</a></span>operator=()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classfoonathan_1_1memory_1_1memory__pool__collection.html">memory_pool_collection</a>&amp; operator= </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classfoonathan_1_1memory_1_1memory__pool__collection.html">memory_pool_collection</a>&lt; PoolType, BucketDistribution, BlockOrRawAllocator &gt; &amp;&amp;&#160;</td>
<td class="paramname"><em>other</em></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">noexcept</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<dl class="section user"><dt>Effects:</dt><dd>Moving a <a class="el" href="classfoonathan_1_1memory_1_1memory__pool__collection.html">memory_pool_collection</a> object transfers ownership over the free lists, i.e. the moved from pool is completely empty and the new one has all its memory. That means that it is not allowed to call <a class="el" href="classfoonathan_1_1memory_1_1memory__pool__collection.html#abea27e87dff3fd937c27956280ffa723">deallocate_node()</a> on a moved-from allocator even when passing it memory that was previously allocated by this object. </dd></dl>
</div>
</div>
<a id="acdb51b626fa21c10ea5e7ff7e0f767b7"></a>
<h2 class="memtitle"><span class="permalink"><a href="#acdb51b626fa21c10ea5e7ff7e0f767b7">&#9670;&nbsp;</a></span>allocate_node()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void* allocate_node </td>
<td>(</td>
<td class="paramtype">std::size_t&#160;</td>
<td class="paramname"><em>node_size</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<dl class="section user"><dt>Effects:</dt><dd>Allocates a <a href="md_doc_concepts.html#concept_node">node</a> of given size. It first finds the appropriate free list as defined in the <code>BucketDistribution</code>. If it is empty, it will use an implementation defined amount of memory from the arena and inserts it in it. If the arena is empty too, it will request a new memory block from the <a href="md_doc_concepts.html#concept_blockallocator">BlockAllocator</a> of size <a class="el" href="classfoonathan_1_1memory_1_1memory__pool__collection.html#af4fe037332aabd13253517d22394da73">next_capacity()</a> and puts part of it onto this free list. Then it removes a node from it. </dd></dl>
<dl class="section user"><dt>Returns:</dt><dd>A <a href="md_doc_concepts.html#concept_node">node</a> of given size suitable aligned, i.e. suitable for any type where <code>sizeof(T) &lt; node_size</code>. </dd></dl>
<dl class="section user"><dt>Throws:</dt><dd>Anything thrown by the <a href="md_doc_concepts.html#concept_blockallocator">BlockAllocator</a> if a growth is needed or a <a class="el" href="classfoonathan_1_1memory_1_1bad__node__size.html">bad_node_size</a> exception if the node size is too big. </dd></dl>
</div>
</div>
<a id="a9d803fa2333bca801c80f1dd49b1919b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a9d803fa2333bca801c80f1dd49b1919b">&#9670;&nbsp;</a></span>try_allocate_node()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">void* try_allocate_node </td>
<td>(</td>
<td class="paramtype">std::size_t&#160;</td>
<td class="paramname"><em>node_size</em></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">noexcept</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<dl class="section user"><dt>Effects:</dt><dd>Allocates a <a href="md_doc_concepts.html#concept_node">node</a> of given size. It is similar to <a class="el" href="classfoonathan_1_1memory_1_1memory__pool__collection.html#acdb51b626fa21c10ea5e7ff7e0f767b7">allocate_node()</a> but will return <code>nullptr</code> on any failure, instead of growing the arnea and possibly throwing. </dd></dl>
<dl class="section user"><dt>Returns:</dt><dd>A <a href="md_doc_concepts.html#concept_node">node</a> of given size suitable aligned or <code>nullptr</code> in case of failure. </dd></dl>
</div>
</div>
<a id="a720a69b26898e57f8ae02719ef396126"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a720a69b26898e57f8ae02719ef396126">&#9670;&nbsp;</a></span>allocate_array()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void* allocate_array </td>
<td>(</td>
<td class="paramtype">std::size_t&#160;</td>
<td class="paramname"><em>count</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">std::size_t&#160;</td>
<td class="paramname"><em>node_size</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<dl class="section user"><dt>Effects:</dt><dd>Allocates an <a href="md_doc_concepts.html#concept_array">array</a> of nodes by searching for <code>n</code> continuous nodes on the appropriate free list and removing them. Depending on the <code>PoolType</code> this can be a slow operation or not allowed at all. This can sometimes lead to a growth on the free list, even if technically there is enough continuous memory on the free list. Otherwise has the same behavior as <a class="el" href="classfoonathan_1_1memory_1_1memory__pool__collection.html#acdb51b626fa21c10ea5e7ff7e0f767b7">allocate_node()</a>. </dd></dl>
<dl class="section user"><dt>Returns:</dt><dd>An array of <code>n</code> nodes of size <code>node_size</code> suitable aligned. </dd></dl>
<dl class="section user"><dt>Throws:</dt><dd>Anything thrown by the used <a href="md_doc_concepts.html#concept_blockallocator">BlockAllocator</a>'s allocation function if a growth is needed, or a <a class="el" href="classfoonathan_1_1memory_1_1bad__allocation__size.html">bad_allocation_size</a> exception. </dd></dl>
<dl class="section user"><dt>Requires:</dt><dd><code>count</code> must be valid <a href="md_doc_concepts.html#concept_array">array count</a> and <code>node_size</code> must be valid <a href="md_doc_concepts.html#concept_node">node size</a>. </dd></dl>
</div>
</div>
<a id="a49e5dcf97500c79bde4841307f3800bd"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a49e5dcf97500c79bde4841307f3800bd">&#9670;&nbsp;</a></span>try_allocate_array()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">void* try_allocate_array </td>
<td>(</td>
<td class="paramtype">std::size_t&#160;</td>
<td class="paramname"><em>count</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">std::size_t&#160;</td>
<td class="paramname"><em>node_size</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">noexcept</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<dl class="section user"><dt>Effects:</dt><dd>Allocates a <a href="md_doc_concepts.html#concept_array">array</a> of given size. It is similar to <a class="el" href="classfoonathan_1_1memory_1_1memory__pool__collection.html#acdb51b626fa21c10ea5e7ff7e0f767b7">allocate_node()</a> but will return <code>nullptr</code> on any failure, instead of growing the arnea and possibly throwing. </dd></dl>
<dl class="section user"><dt>Returns:</dt><dd>A <a href="md_doc_concepts.html#concept_array">array</a> of given size suitable aligned or <code>nullptr</code> in case of failure. </dd></dl>
</div>
</div>
<a id="abea27e87dff3fd937c27956280ffa723"></a>
<h2 class="memtitle"><span class="permalink"><a href="#abea27e87dff3fd937c27956280ffa723">&#9670;&nbsp;</a></span>deallocate_node()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">void deallocate_node </td>
<td>(</td>
<td class="paramtype">void *&#160;</td>
<td class="paramname"><em>ptr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">std::size_t&#160;</td>
<td class="paramname"><em>node_size</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">noexcept</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<dl class="section user"><dt>Effects:</dt><dd>Deallocates a <a href="md_doc_concepts.html#concept_node">node</a> by putting it back onto the appropriate free list. </dd></dl>
<dl class="section user"><dt>Requires:</dt><dd><code>ptr</code> must be a result from a previous call to <a class="el" href="classfoonathan_1_1memory_1_1memory__pool__collection.html#acdb51b626fa21c10ea5e7ff7e0f767b7">allocate_node()</a> with the same size on the same free list, i.e. either this allocator object or a new object created by moving this to it. </dd></dl>
</div>
</div>
<a id="a45aa533ff359590cafe8029be35e7b58"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a45aa533ff359590cafe8029be35e7b58">&#9670;&nbsp;</a></span>try_deallocate_node()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">bool try_deallocate_node </td>
<td>(</td>
<td class="paramtype">void *&#160;</td>
<td class="paramname"><em>ptr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">std::size_t&#160;</td>
<td class="paramname"><em>node_size</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">noexcept</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<dl class="section user"><dt>Effects:</dt><dd>Deallocates a <a href="md_doc_concepts.html#concept_node">node</a> similar to <a class="el" href="classfoonathan_1_1memory_1_1memory__pool__collection.html#abea27e87dff3fd937c27956280ffa723">deallocate_node()</a>. But it checks if it can deallocate this memory. </dd></dl>
<dl class="section user"><dt>Returns:</dt><dd><code>true</code> if the node could be deallocated, <code>false</code> otherwise. </dd></dl>
</div>
</div>
<a id="ade8b16f2361fbc3bc38405142edcad37"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ade8b16f2361fbc3bc38405142edcad37">&#9670;&nbsp;</a></span>deallocate_array()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">void deallocate_array </td>
<td>(</td>
<td class="paramtype">void *&#160;</td>
<td class="paramname"><em>ptr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">std::size_t&#160;</td>
<td class="paramname"><em>count</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">std::size_t&#160;</td>
<td class="paramname"><em>node_size</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">noexcept</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<dl class="section user"><dt>Effects:</dt><dd>Deallocates an <a href="md_doc_concepts.html#concept_array">array</a> by putting it back onto the free list. </dd></dl>
<dl class="section user"><dt>Requires:</dt><dd><code>ptr</code> must be a result from a previous call to <a class="el" href="classfoonathan_1_1memory_1_1memory__pool__collection.html#a720a69b26898e57f8ae02719ef396126">allocate_array()</a> with the same sizes on the same free list, i.e. either this allocator object or a new object created by moving this to it. </dd></dl>
</div>
</div>
<a id="a0e5b9ad4ae5cbbcb262f329ab902badb"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a0e5b9ad4ae5cbbcb262f329ab902badb">&#9670;&nbsp;</a></span>try_deallocate_array()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">bool try_deallocate_array </td>
<td>(</td>
<td class="paramtype">void *&#160;</td>
<td class="paramname"><em>ptr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">std::size_t&#160;</td>
<td class="paramname"><em>count</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">std::size_t&#160;</td>
<td class="paramname"><em>node_size</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">noexcept</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<dl class="section user"><dt>Effects:</dt><dd>Deallocates a <a href="md_doc_concepts.html#concept_array">array</a> similar to <a class="el" href="classfoonathan_1_1memory_1_1memory__pool__collection.html#ade8b16f2361fbc3bc38405142edcad37">deallocate_array()</a>. But it checks if it can deallocate this memory. </dd></dl>
<dl class="section user"><dt>Returns:</dt><dd><code>true</code> if the array could be deallocated, <code>false</code> otherwise. </dd></dl>
</div>
</div>
<a id="a053249e1f3314b2769617d17f3c0aef3"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a053249e1f3314b2769617d17f3c0aef3">&#9670;&nbsp;</a></span>reserve()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void reserve </td>
<td>(</td>
<td class="paramtype">std::size_t&#160;</td>
<td class="paramname"><em>node_size</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">std::size_t&#160;</td>
<td class="paramname"><em>capacity</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<dl class="section user"><dt>Effects:</dt><dd>Inserts more memory on the free list for nodes of given size. It will try to put <code>capacity_left</code> bytes from the arena onto the free list defined over the <code>BucketDistribution</code>, if the arena is empty, a new memory block is requested from the <a href="md_doc_concepts.html#concept_blockallocator">BlockAllocator</a> and it will be used. </dd></dl>
<dl class="section user"><dt>Throws:</dt><dd>Anything thrown by the <a href="md_doc_concepts.html#concept_blockallocator">BlockAllocator</a> if a growth is needed. </dd></dl>
<dl class="section user"><dt>Requires:</dt><dd><code>node_size</code> must be valid <a href="md_doc_concepts.html#concept_node">node size</a> less than or equal to <a class="el" href="classfoonathan_1_1memory_1_1memory__pool__collection.html#acaa832c9a7c293c443582bce418e6ff7">max_node_size()</a>, <code>capacity_left</code> must be less than <a class="el" href="classfoonathan_1_1memory_1_1memory__pool__collection.html#af4fe037332aabd13253517d22394da73">next_capacity()</a>. </dd></dl>
</div>
</div>
<a id="acaa832c9a7c293c443582bce418e6ff7"></a>
<h2 class="memtitle"><span class="permalink"><a href="#acaa832c9a7c293c443582bce418e6ff7">&#9670;&nbsp;</a></span>max_node_size()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">std::size_t max_node_size </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">noexcept</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<dl class="section user"><dt>Returns:</dt><dd>The maximum node size for which is a free list. This is the value passed to it in the constructor. </dd></dl>
</div>
</div>
<a id="ab8a5ee2f65b4927734c4bb5f06c8aec3"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ab8a5ee2f65b4927734c4bb5f06c8aec3">&#9670;&nbsp;</a></span>pool_capacity_left()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">std::size_t pool_capacity_left </td>
<td>(</td>
<td class="paramtype">std::size_t&#160;</td>
<td class="paramname"><em>node_size</em></td><td>)</td>
<td> const</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">noexcept</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<dl class="section user"><dt>Returns:</dt><dd>The amount of nodes available in the free list for nodes of given size as defined over the <code>BucketDistribution</code>. This is the number of nodes that can be allocated without the free list requesting more memory from the arena. </dd></dl>
<dl class="section note"><dt>Note</dt><dd>Array allocations may lead to a growth even if the capacity_left is big enough. </dd></dl>
</div>
</div>
<a id="a97da77ca5a46e5e3088d6c0637b52af7"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a97da77ca5a46e5e3088d6c0637b52af7">&#9670;&nbsp;</a></span>capacity_left()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">std::size_t capacity_left </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">noexcept</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<dl class="section user"><dt>Returns:</dt><dd>The amount of memory available in the arena not inside the free lists. This is the number of bytes that can be inserted into the free lists without requesting more memory from the <a href="md_doc_concepts.html#concept_blockallocator">BlockAllocator</a>. </dd></dl>
<dl class="section note"><dt>Note</dt><dd>Array allocations may lead to a growth even if the capacity is big enough. </dd></dl>
</div>
</div>
<a id="af4fe037332aabd13253517d22394da73"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af4fe037332aabd13253517d22394da73">&#9670;&nbsp;</a></span>next_capacity()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">std::size_t next_capacity </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">noexcept</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<dl class="section user"><dt>Returns:</dt><dd>The size of the next memory block after <a class="el" href="classfoonathan_1_1memory_1_1memory__pool__collection.html#a97da77ca5a46e5e3088d6c0637b52af7">capacity_left()</a> arena grows. This is the amount of memory that can be distributed in the pools. </dd></dl>
<dl class="section note"><dt>Note</dt><dd>If the <code>PoolType</code> is <a class="el" href="structfoonathan_1_1memory_1_1small__node__pool.html">small_node_pool</a>, the exact usable memory is lower than that. </dd></dl>
</div>
</div>
<a id="a3ae445687ecb4a037b542ede5c6f48ac"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a3ae445687ecb4a037b542ede5c6f48ac">&#9670;&nbsp;</a></span>get_allocator()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">allocator_type&amp; get_allocator </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">noexcept</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<dl class="section user"><dt>Returns:</dt><dd>A reference to the <a href="md_doc_concepts.html#concept_blockallocator">BlockAllocator</a> used for managing the arena. </dd></dl>
<dl class="section user"><dt>Requires:</dt><dd>It is undefined behavior to move this allocator out into another object. </dd></dl>
</div>
</div>
</div><!-- contents -->
<!-- HTML footer for doxygen 1.8.16-->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.18
</small></address>
</body>
</html>
1
https://gitee.com/mobangjack/memory.git
git@gitee.com:mobangjack/memory.git
mobangjack
memory
memory
gh-pages

搜索帮助