1 Star 0 Fork 0

mobangjack / memory

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
classfoonathan_1_1memory_1_1static__allocator.html 12.45 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: static_allocator Class 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_1static__allocator.html">static_allocator</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">static_allocator Class 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"><p>A stateful <a href="md_doc_concepts.html#concept_rawallocator">RawAllocator</a> that uses a fixed sized storage for the allocations. </p>
<p>It works on a <a class="el" href="structfoonathan_1_1memory_1_1static__allocator__storage.html">static_allocator_storage</a> and uses its memory for all allocations. Deallocations are not supported, memory cannot be marked as freed.<br />
</p><dl class="section note"><dt>Note</dt><dd>It is not allowed to share an <a class="el" href="structfoonathan_1_1memory_1_1static__allocator__storage.html">static_allocator_storage</a> between multiple <a class="el" href="classfoonathan_1_1memory_1_1static__allocator.html">static_allocator</a> objects. </dd></dl>
</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:aa60441e067587b7756b1c1727c928d3d"><td class="memItemLeft" align="right" valign="top"><a id="aa60441e067587b7756b1c1727c928d3d"></a>
using&#160;</td><td class="memItemRight" valign="bottom"><b>is_stateful</b> = std::true_type</td></tr>
<tr class="separator:aa60441e067587b7756b1c1727c928d3d"><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:a1d03374bbbdf2f1885fc620aaf3b9e40"><td class="memTemplParams" colspan="2">template&lt;std::size_t Size&gt; </td></tr>
<tr class="memitem:a1d03374bbbdf2f1885fc620aaf3b9e40"><td class="memTemplItemLeft" align="right" valign="top">&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classfoonathan_1_1memory_1_1static__allocator.html#a1d03374bbbdf2f1885fc620aaf3b9e40">static_allocator</a> (<a class="el" href="structfoonathan_1_1memory_1_1static__allocator__storage.html">static_allocator_storage</a>&lt; Size &gt; &amp;storage) noexcept</td></tr>
<tr class="separator:a1d03374bbbdf2f1885fc620aaf3b9e40"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa0774f4f3278b78aab48272657c8da07"><td class="memItemLeft" align="right" valign="top">void *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classfoonathan_1_1memory_1_1static__allocator.html#aa0774f4f3278b78aab48272657c8da07">allocate_node</a> (std::size_t size, std::size_t alignment)</td></tr>
<tr class="separator:aa0774f4f3278b78aab48272657c8da07"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a624e9596c2c5b7d8f9352efc53f42f33"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classfoonathan_1_1memory_1_1static__allocator.html#a624e9596c2c5b7d8f9352efc53f42f33">deallocate_node</a> (void *, std::size_t, std::size_t) noexcept</td></tr>
<tr class="separator:a624e9596c2c5b7d8f9352efc53f42f33"><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_1static__allocator.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:ad27c2a48d0e62db7ea79ae69f2fa7708"><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_1static__allocator.html#ad27c2a48d0e62db7ea79ae69f2fa7708">max_alignment</a> () const noexcept</td></tr>
<tr class="separator:ad27c2a48d0e62db7ea79ae69f2fa7708"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Constructors</h2>
<a id="a1d03374bbbdf2f1885fc620aaf3b9e40"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a1d03374bbbdf2f1885fc620aaf3b9e40">&#9670;&nbsp;</a></span>static_allocator()</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_1static__allocator.html">static_allocator</a> </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structfoonathan_1_1memory_1_1static__allocator__storage.html">static_allocator_storage</a>&lt; Size &gt; &amp;&#160;</td>
<td class="paramname"><em>storage</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>Creates it by passing it a <a class="el" href="structfoonathan_1_1memory_1_1static__allocator__storage.html">static_allocator_storage</a> by reference. It will take the address of the storage and use its memory for the allocation. </dd></dl>
<dl class="section user"><dt>Requires:</dt><dd>The storage object must live as long as the allocator object. It must not be shared between multiple allocators, i.e. the object must not have been passed to a constructor before. </dd></dl>
</div>
</div>
<h2 class="groupheader">Member Functions</h2>
<a id="aa0774f4f3278b78aab48272657c8da07"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa0774f4f3278b78aab48272657c8da07">&#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>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>
</div><div class="memdoc">
<dl class="section user"><dt>Effects:</dt><dd>A <a href="md_doc_concepts.html#concept_rawallocator">RawAllocator</a> allocation function. It uses the specified <a class="el" href="structfoonathan_1_1memory_1_1static__allocator__storage.html">static_allocator_storage</a>. </dd></dl>
<dl class="section user"><dt>Returns:</dt><dd>A pointer to a <a href="md_doc_concepts.html#concept_node">node</a>, it will never be <code>nullptr</code>. </dd></dl>
<dl class="section user"><dt>Throws:</dt><dd>An exception of type <a class="el" href="classfoonathan_1_1memory_1_1out__of__memory.html">out_of_memory</a> or whatever is thrown by its handler if the storage is exhausted. </dd></dl>
</div>
</div>
<a id="a624e9596c2c5b7d8f9352efc53f42f33"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a624e9596c2c5b7d8f9352efc53f42f33">&#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">, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">std::size_t&#160;</td>
<td class="paramname">, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">std::size_t&#160;</td>
<td class="paramname">&#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>A <a href="md_doc_concepts.html#concept_rawallocator">RawAllocator</a> deallocation function. It does nothing, deallocation is not supported by this allocator. </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 which is the capacity remaining inside the <a class="el" href="structfoonathan_1_1memory_1_1static__allocator__storage.html">static_allocator_storage</a>. </dd></dl>
</div>
</div>
<a id="ad27c2a48d0e62db7ea79ae69f2fa7708"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad27c2a48d0e62db7ea79ae69f2fa7708">&#9670;&nbsp;</a></span>max_alignment()</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_alignment </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 possible value since there is no alignment restriction (except indirectly through the size of the <a class="el" href="structfoonathan_1_1memory_1_1static__allocator__storage.html">static_allocator_storage</a>). </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

搜索帮助