1 Star 0 Fork 0

mobangjack / memory

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
classfoonathan_1_1memory_1_1double__frame__allocator.html 15.83 KB
一键复制 编辑 原始数据 按行查看 历史
Jonathan Müller 提交于 2020-05-05 17:04 . Update documentation
<!-- 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: double_frame_allocator&lt; 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_1double__frame__allocator.html">double_frame_allocator</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#pub-types">Typedefs</a> &#124;
<a href="#pub-static-methods">Static Functions</a> &#124;
<a href="#pub-methods">Member Functions</a> </div>
<div class="headertitle">
<div class="title">double_frame_allocator&lt; 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 BlockOrRawAllocator = default_allocator&gt;<br />
class foonathan::memory::double_frame_allocator&lt; BlockOrRawAllocator &gt;</h3>
<p>An alias for <a class="el" href="classfoonathan_1_1memory_1_1iteration__allocator.html">iteration_allocator</a> for two iterations. </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:a66f19d7c87cb8fabfa2b189d9ed3e46e"><td class="memItemLeft" align="right" valign="top"><a id="a66f19d7c87cb8fabfa2b189d9ed3e46e"></a>
using&#160;</td><td class="memItemRight" valign="bottom"><b>allocator_type</b> = detail::iteration_block_allocator&lt; <a class="el" href="group__allocator.html#ga10acce2d854fc42fea7306e511d9cd10">default_allocator</a> &gt;</td></tr>
<tr class="separator:a66f19d7c87cb8fabfa2b189d9ed3e46e"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-static-methods"></a>
Static Functions</h2></td></tr>
<tr class="memitem:a406546cb7e65ed84b61f64cab325ffb6"><td class="memItemLeft" align="right" valign="top">static std::size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classfoonathan_1_1memory_1_1iteration__allocator.html#a406546cb7e65ed84b61f64cab325ffb6">max_iterations</a> () noexcept</td></tr>
<tr class="separator:a406546cb7e65ed84b61f64cab325ffb6"><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:a25a97fd86cd1ca7b24d7853c737824bb"><td class="memItemLeft" align="right" valign="top">void *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classfoonathan_1_1memory_1_1iteration__allocator.html#a25a97fd86cd1ca7b24d7853c737824bb">allocate</a> (std::size_t size, std::size_t alignment)</td></tr>
<tr class="separator:a25a97fd86cd1ca7b24d7853c737824bb"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a859a385b3dc6459e9b819334a2fd10ab"><td class="memItemLeft" align="right" valign="top">void *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classfoonathan_1_1memory_1_1iteration__allocator.html#a859a385b3dc6459e9b819334a2fd10ab">try_allocate</a> (std::size_t size, std::size_t alignment) noexcept</td></tr>
<tr class="separator:a859a385b3dc6459e9b819334a2fd10ab"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a65a296a16ed14c59bb5324ba6f0deaa6"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classfoonathan_1_1memory_1_1iteration__allocator.html#a65a296a16ed14c59bb5324ba6f0deaa6">next_iteration</a> () noexcept</td></tr>
<tr class="separator:a65a296a16ed14c59bb5324ba6f0deaa6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2dce02bab858a368ced65049d584108f"><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_1iteration__allocator.html#a2dce02bab858a368ced65049d584108f">cur_iteration</a> () const noexcept</td></tr>
<tr class="separator:a2dce02bab858a368ced65049d584108f"><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_1iteration__allocator.html#a3ae445687ecb4a037b542ede5c6f48ac">get_allocator</a> () noexcept</td></tr>
<tr class="separator:a3ae445687ecb4a037b542ede5c6f48ac"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa6cf0cf3b5ef00ff51c38a577d7b5bf2"><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_1iteration__allocator.html#aa6cf0cf3b5ef00ff51c38a577d7b5bf2">capacity_left</a> (std::size_t i) const noexcept</td></tr>
<tr class="separator:aa6cf0cf3b5ef00ff51c38a577d7b5bf2"><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_1iteration__allocator.html#a97da77ca5a46e5e3088d6c0637b52af7">capacity_left</a> () const noexcept</td></tr>
<tr class="separator:a97da77ca5a46e5e3088d6c0637b52af7"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Member Functions</h2>
<a id="a25a97fd86cd1ca7b24d7853c737824bb"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a25a97fd86cd1ca7b24d7853c737824bb">&#9670;&nbsp;</a></span>allocate()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">void* allocate </td>
<td>(</td>
<td class="paramtype">std::size_t&#160;</td>
<td class="paramname"><em>size</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">std::size_t&#160;</td>
<td class="paramname"><em>alignment</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">inherited</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<dl class="section user"><dt>Effects:</dt><dd>Allocates a memory block of given size and alignment. It simply moves the top marker of the currently active stack. </dd></dl>
<dl class="section user"><dt>Returns:</dt><dd>A <a href="md_doc_concepts.html#concept_node">node</a> with given size and alignment. </dd></dl>
<dl class="section user"><dt>Throws:</dt><dd><a class="el" href="classfoonathan_1_1memory_1_1out__of__fixed__memory.html">out_of_fixed_memory</a> if the current stack does not have any memory left. </dd></dl>
<dl class="section user"><dt>Requires:</dt><dd><code>size</code> and <code>alignment</code> must be valid. </dd></dl>
</div>
</div>
<a id="a859a385b3dc6459e9b819334a2fd10ab"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a859a385b3dc6459e9b819334a2fd10ab">&#9670;&nbsp;</a></span>try_allocate()</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 </td>
<td>(</td>
<td class="paramtype">std::size_t&#160;</td>
<td class="paramname"><em>size</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">std::size_t&#160;</td>
<td class="paramname"><em>alignment</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 class="mlabel">inherited</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<dl class="section user"><dt>Effects:</dt><dd>Allocates a memory block of given size and alignment similar to <a class="el" href="classfoonathan_1_1memory_1_1iteration__allocator.html#a25a97fd86cd1ca7b24d7853c737824bb">allocate()</a>. </dd></dl>
<dl class="section user"><dt>Returns:</dt><dd>A <a href="md_doc_concepts.html#concept_node">node</a> with given size and alignment or <code>nullptr</code> if the current stack does not have any memory left. </dd></dl>
</div>
</div>
<a id="a65a296a16ed14c59bb5324ba6f0deaa6"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a65a296a16ed14c59bb5324ba6f0deaa6">&#9670;&nbsp;</a></span>next_iteration()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">void next_iteration</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">noexcept</span><span class="mlabel">inherited</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<dl class="section user"><dt>Effects:</dt><dd>Goes to the next internal stack. This will clear the stack whose <a class="el" href="classfoonathan_1_1memory_1_1iteration__allocator.html#a406546cb7e65ed84b61f64cab325ffb6">max_iterations()</a> lifetime has reached, and use it for all allocations in this iteration. </dd></dl>
<dl class="section note"><dt>Note</dt><dd>This function should be called at the end of the loop. </dd></dl>
</div>
</div>
<a id="a406546cb7e65ed84b61f64cab325ffb6"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a406546cb7e65ed84b61f64cab325ffb6">&#9670;&nbsp;</a></span>max_iterations()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">static std::size_t max_iterations</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span><span class="mlabel">noexcept</span><span class="mlabel">inherited</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<dl class="section user"><dt>Returns:</dt><dd>The number of iteration each allocation will live. This is the template parameter <code>N</code>. </dd></dl>
</div>
</div>
<a id="a2dce02bab858a368ced65049d584108f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a2dce02bab858a368ced65049d584108f">&#9670;&nbsp;</a></span>cur_iteration()</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 cur_iteration</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">noexcept</span><span class="mlabel">inherited</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<dl class="section user"><dt>Returns:</dt><dd>The index of the current iteration. This is modulo <a class="el" href="classfoonathan_1_1memory_1_1iteration__allocator.html#a406546cb7e65ed84b61f64cab325ffb6">max_iterations()</a>. </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>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">noexcept</span><span class="mlabel">inherited</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 memory. </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>
<a id="aa6cf0cf3b5ef00ff51c38a577d7b5bf2"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa6cf0cf3b5ef00ff51c38a577d7b5bf2">&#9670;&nbsp;</a></span>capacity_left() <span class="overload">[1/2]</span></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="paramtype">std::size_t&#160;</td>
<td class="paramname"><em>i</em></td><td>)</td>
<td> const</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">noexcept</span><span class="mlabel">inherited</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<dl class="section user"><dt>Returns:</dt><dd>The amount of memory remaining in the stack with the given index. This is the number of bytes that are available for allocation. </dd></dl>
</div>
</div>
<a id="a97da77ca5a46e5e3088d6c0637b52af7"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a97da77ca5a46e5e3088d6c0637b52af7">&#9670;&nbsp;</a></span>capacity_left() <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">std::size_t capacity_left</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">noexcept</span><span class="mlabel">inherited</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<dl class="section user"><dt>Returns:</dt><dd>The amount of memory remaining in the currently active stack. </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

搜索帮助