Files
entt/md_docs_md_container.html
2023-06-15 11:47:04 +02:00

110 lines
5.8 KiB
HTML

<!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" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.6"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>EnTT: Crash Course: containers</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="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen-awesome.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 id="projectrow">
<td id="projectalign">
<div id="projectname">EnTT<span id="projectnumber">&#160;3.12.0</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.6 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search/",'.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>
</div><!-- top -->
<div><div class="header">
<div class="headertitle"><div class="title">Crash Course: containers </div></div>
</div><!--header-->
<div class="contents">
<div class="textblock"><h1><a class="anchor" id="autotoc_md14"></a>
Introduction</h1>
<p>The standard C++ library offers a wide range of containers and it's really difficult to do better (although it's very easy to do worse, as many examples available online demonstrate).<br />
<code>EnTT</code> doesn't try in any way to replace what is offered by the standard. Quite the opposite, given the widespread use that is made of standard containers.<br />
However, the library also tries to fill a gap in features and functionalities by making available some containers initially developed for internal use.</p>
<p>This section of the library is likely to grow larger over time. However, for the moment it's quite small and mainly aimed at satisfying some internal needs.<br />
For all containers made available, full test coverage and stability over time is guaranteed as usual.</p>
<h1><a class="anchor" id="autotoc_md15"></a>
Containers</h1>
<h2><a class="anchor" id="autotoc_md16"></a>
Dense map</h2>
<p>The dense map made available in <code>EnTT</code> is a hash map that aims to return a packed array of elements, so as to reduce the number of jumps in memory during iterations.<br />
The implementation is based on <em>sparse sets</em> and each bucket is identified by an implicit list within the packed array itself.</p>
<p>The interface is very close to its counterpart in the standard library, that is, the <code>std::unordered_map</code> class.<br />
However, both local and non-local iterators returned by a dense map belong to the input iterator category although they respectively model the concepts of a <em>forward iterator</em> type and a <em>random access iterator</em> type.<br />
This is because they return a pair of references rather than a reference to a pair. In other words, dense maps return a so called <em>proxy iterator</em> the value type of which is:</p>
<ul>
<li><code>std::pair&lt;const Key &amp;, Type &amp;&gt;</code> for non-const iterator types.</li>
<li><code>std::pair&lt;const Key &amp;, const Type &amp;&gt;</code> for const iterator types.</li>
</ul>
<p>This is quite different from what any standard library map returns and should be taken into account when looking for a drop-in replacement.</p>
<h2><a class="anchor" id="autotoc_md17"></a>
Dense set</h2>
<p>The dense set made available in <code>EnTT</code> is a hash set that aims to return a packed array of elements, so as to reduce the number of jumps in memory during iterations.<br />
The implementation is based on <em>sparse sets</em> and each bucket is identified by an implicit list within the packed array itself.</p>
<p>The interface is in all respects similar to its counterpart in the standard library, that is, the <code>std::unordered_set</code> class.<br />
Therefore, there is no need to go into the API description. </p>
</div></div><!-- contents -->
</div><!-- PageDoc -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.6
</small></address>
</body>
</html>