Documentation for 8b1eab204b

This commit is contained in:
realstealthninja
2024-11-04 12:43:05 +00:00
parent 4fb6e622e9
commit a7bccf7d01
6732 changed files with 153919 additions and 365711 deletions

View File

@@ -1,3 +1,4 @@
<!-- HTML header for doxygen 1.12.0-->
<!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>
@@ -5,10 +6,15 @@
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.12.0"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Algorithms_in_C++: others/lru_cache2.cpp File Reference</title>
<title>TheAlgorithms/C++: others/lru_cache2.cpp File Reference</title>
<link rel="icon" href="../../favicon.svg" type="image/x-icon" />
<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>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@xpack-3rd-party/doxygen-awesome-css@2.2.0-1/doxygen-awesome-darkmode-toggle.js"></script>
<script type="text/javascript">
DoxygenAwesomeDarkModeToggle.init()
</script>
<script type="text/javascript" src="../../clipboard.js"></script>
<link href="../../navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../navtreedata.js"></script>
@@ -18,14 +24,24 @@
<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>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
jax: ["input/TeX","output/HTML-CSS"],
});
<script type="text/javascript">
window.MathJax = {
options: {
ignoreHtmlClass: 'tex2jax_ignore',
processHtmlClass: 'tex2jax_process'
},
loader: {
load: ['[tex]/ams']
},
tex: {
macros: {},
packages: ['base','configmacros','ams']
}
};
</script>
<script type="text/javascript" async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML/MathJax.js"></script>
<script type="text/javascript" id="MathJax-script" async="async" src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js"></script>
<link href="../../doxygen.css" rel="stylesheet" type="text/css" />
<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! -->
@@ -33,10 +49,11 @@ MathJax.Hub.Config({
<table cellspacing="0" cellpadding="0">
<tbody>
<tr id="projectrow">
<td id="projectlogo"><img alt="Logo" src="../../project_logo.png"/></td>
<td id="projectalign">
<div id="projectname">Algorithms_in_C++<span id="projectnumber">&#160;1.0.0</span>
<div id="projectname">TheAlgorithms/C++<span id="projectnumber">&#160;1.0.0</span>
</div>
<div id="projectbrief">Set of algorithms implemented in C++.</div>
<div id="projectbrief">All the algorithms implemented in C++</div>
</td>
</tr>
</tbody>
@@ -123,7 +140,9 @@ Include dependency graph for lru_cache2.cpp:</div>
<div class="dyncontent">
<div class="center"><iframe scrolling="no" frameborder="0" src="../../d4/d89/lru__cache2_8cpp__incl.svg" width="390" height="111"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div>
</div>
</div><table class="memberdecls">
</div>
<p><a href="../../dc/daa/lru__cache2_8cpp_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="nested-classes" name="nested-classes"></a>
Classes</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../de/d21/classothers_1_1_cache_1_1_d___node.html">others::Cache::D_Node&lt; T &gt;</a></td></tr>
@@ -157,6 +176,8 @@ Functions</h2></td></tr>
<p>unordered_map maps the key to the address of the node of the linked list. If the element is accessed, the element is moved to the beginning of the linked list.</p>
<p>When the cache is full, the last element in the linked list is popped.</p>
<dl class="section author"><dt>Author</dt><dd><a href="https://github.com/deDSeC00720" target="_blank">Karan Sharma</a> </dd></dl>
<p class="definition">Definition in file <a class="el" href="../../dc/daa/lru__cache2_8cpp_source.html">lru_cache2.cpp</a>.</p>
</div><h2 class="groupheader">Function Documentation</h2>
<a id="ae66f6b31b5ad750f1fe042a706a4e3d4" name="ae66f6b31b5ad750f1fe042a706a4e3d4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae66f6b31b5ad750f1fe042a706a4e3d4">&#9670;&#160;</a></span>main()</h2>
@@ -175,17 +196,14 @@ Functions</h2></td></tr>
<p>main function </p>
<dl class="section return"><dt>Returns</dt><dd>0 on exit </dd></dl>
<p class="definition">Definition at line <a class="el" href="../../dc/daa/lru__cache2_8cpp_source.html#l00274">274</a> of file <a class="el" href="../../dc/daa/lru__cache2_8cpp_source.html">lru_cache2.cpp</a>.</p>
<div class="fragment"><div class="line"><span class="lineno"> 274</span> {</div>
<div class="line"><span class="lineno"> 275</span> <a class="code hl_function" href="#aa8dca7b867074164d5f45b0f3851269d">test</a>(); <span class="comment">// run the self test implementation</span></div>
<div class="line"><span class="lineno"> 276</span> <span class="keywordflow">return</span> 0;</div>
<div class="line"><span class="lineno"> 277</span>}</div>
<div class="ttc" id="alru__cache2_8cpp_html_aa8dca7b867074164d5f45b0f3851269d"><div class="ttname"><a href="#aa8dca7b867074164d5f45b0f3851269d">test</a></div><div class="ttdeci">static void test()</div><div class="ttdoc">self test implementations</div><div class="ttdef"><b>Definition</b> lru_cache2.cpp:220</div></div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">
<div class="center"><div class="zoom"><iframe scrolling="no" frameborder="0" src="../../dc/daa/lru__cache2_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg" width="100%" height="560"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div></div>
</div>
<div class="ttc" id="alru__cache2_8cpp_html_aa8dca7b867074164d5f45b0f3851269d"><div class="ttname"><a href="#aa8dca7b867074164d5f45b0f3851269d">test</a></div><div class="ttdeci">static void test()</div><div class="ttdoc">self test implementations</div><div class="ttdef"><b>Definition</b> <a href="../../dc/daa/lru__cache2_8cpp_source.html#l00220">lru_cache2.cpp:220</a></div></div>
</div><!-- fragment -->
</div>
</div>
<a id="aa8dca7b867074164d5f45b0f3851269d" name="aa8dca7b867074164d5f45b0f3851269d"></a>
@@ -213,6 +231,8 @@ Here is the call graph for this function:</div>
<p>self test implementations </p>
<dl class="section return"><dt>Returns</dt><dd>void </dd></dl>
<p class="definition">Definition at line <a class="el" href="../../dc/daa/lru__cache2_8cpp_source.html#l00220">220</a> of file <a class="el" href="../../dc/daa/lru__cache2_8cpp_source.html">lru_cache2.cpp</a>.</p>
<div class="fragment"><div class="line"><span class="lineno"> 220</span> {</div>
<div class="line"><span class="lineno"> 221</span> <a class="code hl_class" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html">others::Cache::LRUCache&lt;int, int&gt;</a> cache(5);</div>
<div class="line"><span class="lineno"> 222</span> </div>
@@ -249,8 +269,8 @@ Here is the call graph for this function:</div>
<div class="line"><span class="lineno"> 253</span> <span class="comment">// when 6 was added</span></div>
<div class="line"><span class="lineno"> 254</span> <span class="keywordflow">try</span> {</div>
<div class="line"><span class="lineno"> 255</span> cache.get(1);</div>
<div class="line"><span class="lineno"> 256</span> } <span class="keywordflow">catch</span> (<span class="keyword">const</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/error/runtime_error.html">std::runtime_error</a> &amp;e) {</div>
<div class="line"><span class="lineno"> 257</span> assert(<a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a>(e.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/error/exception/what.html">what</a>()) == <span class="stringliteral">&quot;key is not present in the cache&quot;</span>);</div>
<div class="line"><span class="lineno"> 256</span> } <span class="keywordflow">catch</span> (<span class="keyword">const</span> std::runtime_error &amp;e) {</div>
<div class="line"><span class="lineno"> 257</span> assert(std::string(e.what()) == <span class="stringliteral">&quot;key is not present in the cache&quot;</span>);</div>
<div class="line"><span class="lineno"> 258</span> }</div>
<div class="line"><span class="lineno"> 259</span> </div>
<div class="line"><span class="lineno"> 260</span> <span class="comment">// test retrieval of all items in the cache</span></div>
@@ -260,19 +280,10 @@ Here is the call graph for this function:</div>
<div class="line"><span class="lineno"> 264</span> assert(cache.get(5) == -50);</div>
<div class="line"><span class="lineno"> 265</span> assert(cache.get(6) == 60);</div>
<div class="line"><span class="lineno"> 266</span> </div>
<div class="line"><span class="lineno"> 267</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot;test - passed\n&quot;</span>;</div>
<div class="line"><span class="lineno"> 267</span> std::cout &lt;&lt; <span class="stringliteral">&quot;test - passed\n&quot;</span>;</div>
<div class="line"><span class="lineno"> 268</span>}</div>
<div class="ttc" id="abasic_ostream_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a></div></div>
<div class="ttc" id="abasic_string_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a></div></div>
<div class="ttc" id="aclassothers_1_1_cache_1_1_l_r_u_cache_html"><div class="ttname"><a href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html">others::Cache::LRUCache</a></div><div class="ttdoc">LRUCache.</div><div class="ttdef"><b>Definition</b> lru_cache2.cpp:61</div></div>
<div class="ttc" id="aruntime_error_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/error/runtime_error.html">std::runtime_error</a></div></div>
<div class="ttc" id="awhat_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/error/exception/what.html">std::runtime_error::what</a></div><div class="ttdeci">T what(T... args)</div></div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">
<div class="center"><div class="zoom"><iframe scrolling="no" frameborder="0" src="../../dc/daa/lru__cache2_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.svg" width="100%" height="560"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div></div>
</div>
<div class="ttc" id="aclassothers_1_1_cache_1_1_l_r_u_cache_html"><div class="ttname"><a href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html">others::Cache::LRUCache</a></div><div class="ttdoc">LRUCache.</div><div class="ttdef"><b>Definition</b> <a href="../../dc/daa/lru__cache2_8cpp_source.html#l00061">lru_cache2.cpp:61</a></div></div>
</div><!-- fragment -->
</div>
</div>
</div><!-- contents -->

View File

@@ -1,23 +0,0 @@
<map id="test" name="test">
<area shape="rect" id="Node000001" title="self test implementations" alt="" coords="5,161,49,186"/>
<area shape="rect" id="Node000002" href="$d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#af8edfe5a7def5d5b846463041c33136a" title="Returns the total capacity of the cache." alt="" coords="110,5,286,46"/>
<area shape="poly" id="edge1_Node000001_Node000002" title=" " alt="" coords="30,159,53,110,71,81,95,57,102,52,105,56,98,61,76,85,57,112,35,161"/>
<area shape="rect" id="Node000003" href="$d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#ab8b6a6aa95db678596bc2a49e864683e" title="returns whether the cache is empty or not" alt="" coords="110,71,286,111"/>
<area shape="poly" id="edge2_Node000001_Node000003" title=" " alt="" coords="41,158,66,139,95,121,107,115,109,120,98,125,69,144,45,163"/>
<area shape="rect" id="Node000004" href="$d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#ac1be0357ecc7c34144f3d9a63c6cb3ea" title="get the value of the key&#45;value pair if exists" alt="" coords="97,136,299,161"/>
<area shape="poly" id="edge3_Node000001_Node000004" title=" " alt="" coords="49,168,92,161,93,167,50,173"/>
<area shape="rect" id="Node000007" href="$d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a5ee34fcee480f21bb6f68a34f0f69b45" title="upsert a key&#45;value pair" alt="" coords="97,185,299,210"/>
<area shape="poly" id="edge6_Node000001_Node000007" title=" " alt="" coords="50,174,88,179,87,185,49,179"/>
<area shape="rect" id="Node000009" href="$d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a1b709333874b4633ee02a3661cd042e1" title="Returns the number of items present in the cache." alt="" coords="110,235,286,275"/>
<area shape="poly" id="edge10_Node000001_Node000009" title=" " alt="" coords="45,185,69,203,98,221,110,226,107,231,95,225,66,208,42,189"/>
<area shape="rect" id="Node000010" href="/Users/runner/work/C-Plus-Plus/C-Plus-Plus/doc/cppreference-doxygen-web.tag.xml$cpp/error/exception/what.html#" title=" " alt="" coords="136,300,260,341"/>
<area shape="poly" id="edge11_Node000001_Node000010" title=" " alt="" coords="35,186,58,234,76,261,98,285,124,300,121,305,95,289,71,265,53,237,30,188"/>
<area shape="rect" id="Node000005" href="$d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#ad022d494b40f82417340b113445e79a4" title="move the existing node in the list to the beginning of the list." alt="" coords="347,124,523,165"/>
<area shape="poly" id="edge4_Node000004_Node000005" title=" " alt="" coords="299,144,331,143,331,149,299,149"/>
<area shape="rect" id="Node000006" href="$d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a2e53b5ad1368d87da501f61473eb9ea2" title="push the node to the front of the linked list." alt="" coords="571,153,748,194"/>
<area shape="poly" id="edge5_Node000005_Node000006" title=" " alt="" coords="524,153,556,157,555,163,523,158"/>
<area shape="poly" id="edge7_Node000007_Node000005" title=" " alt="" coords="258,182,331,165,333,170,259,187"/>
<area shape="poly" id="edge9_Node000007_Node000006" title=" " alt="" coords="299,190,556,176,556,182,299,195"/>
<area shape="rect" id="Node000008" href="$d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#ab211a4be58491bf11834cae88a0c44f7" title="pop the last node in the linked list." alt="" coords="347,239,523,279"/>
<area shape="poly" id="edge8_Node000007_Node000008" title=" " alt="" coords="253,209,300,220,342,232,341,237,298,226,252,214"/>
</map>

View File

@@ -1 +0,0 @@
97c1ae9df20c10d14b9ce242561c8cd9

View File

@@ -1,291 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 12.1.2 (20240928.0832)
-->
<!-- Title: test Pages: 1 -->
<!--zoomable 260 -->
<svg id="main" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" onload="init(evt)">
<style type="text/css"><![CDATA[
.node, .edge {opacity: 0.7;}
.node.selected, .edge.selected {opacity: 1;}
.edge:hover path { stroke: red; }
.edge:hover polygon { stroke: red; fill: red; }
]]></style>
<defs>
<circle id="rim" cx="0" cy="0" r="7"/>
<circle id="rim2" cx="0" cy="0" r="3.5"/>
<g id="zoomPlus">
<use xlink:href="#rim" fill="#404040"><set attributeName="fill" to="#808080" begin="zoomplus.mouseover" end="zoomplus.mouseout"/></use>
<path d="M-4,0h8M0,-4v8" fill="none" stroke="white" stroke-width="1.5" pointer-events="none"/>
</g>
<g id="zoomMin">
<use xlink:href="#rim" fill="#404040"><set attributeName="fill" to="#808080" begin="zoomminus.mouseover" end="zoomminus.mouseout"/></use>
<path d="M-4,0h8" fill="none" stroke="white" stroke-width="1.5" pointer-events="none"/>
</g>
<g id="arrowUp" transform="translate(30 24)">
<use xlink:href="#rim"/>
<path pointer-events="none" fill="none" stroke="white" stroke-width="1.5" d="M0,-3.0v7 M-2.5,-0.5L0,-3.0L2.5,-0.5"/>
</g>
<g id="arrowRight" transform="rotate(90) translate(36 -43)">
<use xlink:href="#rim"/>
<path pointer-events="none" fill="none" stroke="white" stroke-width="1.5" d="M0,-3.0v7 M-2.5,-0.5L0,-3.0L2.5,-0.5"/>
</g>
<g id="arrowDown" transform="rotate(180) translate(-30 -48)">
<use xlink:href="#rim"/>
<path pointer-events="none" fill="none" stroke="white" stroke-width="1.5" d="M0,-3.0v7 M-2.5,-0.5L0,-3.0L2.5,-0.5"/>
</g>
<g id="arrowLeft" transform="rotate(270) translate(-36 17)">
<use xlink:href="#rim"/>
<path pointer-events="none" fill="none" stroke="white" stroke-width="1.5" d="M0,-3.0v7 M-2.5,-0.5L0,-3.0L2.5,-0.5"/>
</g>
<g id="resetDef">
<use xlink:href="#rim2" fill="#404040"><set attributeName="fill" to="#808080" begin="reset.mouseover" end="reset.mouseout"/></use>
</g>
</defs>
<script type="application/ecmascript">
var viewWidth = 565;
var viewHeight = 260;
var sectionId = 'dynsection-2';
</script>
<script type="application/ecmascript" xlink:href="../../svg.min.js"/>
<svg id="graph" class="graph">
<g id="viewport">
<title>test</title>
<!-- Node1 -->
<g id="Node000001" class="node">
<title>Node1</title>
<g id="a_Node000001"><a xlink:title="self test implementations">
<polygon fill="#999999" stroke="#666666" points="32.5,-134.88 0,-134.88 0,-115.62 32.5,-115.62 32.5,-134.88"/>
<text text-anchor="middle" x="16.25" y="-121.38" font-family="Helvetica,sans-Serif" font-size="10.00">test</text>
</a>
</g>
</g>
<!-- Node2 -->
<g id="Node000002" class="node">
<title>Node2</title>
<g id="a_Node000002"><a xlink:href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#af8edfe5a7def5d5b846463041c33136a" target="_top" xlink:title="Returns the total capacity of the cache.">
<polygon fill="white" stroke="#666666" points="210.5,-251.5 78.25,-251.5 78.25,-221 210.5,-221 210.5,-251.5"/>
<text text-anchor="start" x="86.25" y="-238" font-family="Helvetica,sans-Serif" font-size="10.00">others::Cache::LRUCache</text>
<text text-anchor="middle" x="144.38" y="-226.75" font-family="Helvetica,sans-Serif" font-size="10.00">::capacity</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node2 -->
<g id="edge1_Node000001_Node000002" class="edge">
<title>Node1&#45;&gt;Node2</title>
<g id="a_edge1_Node000001_Node000002"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M20.58,-135.32C27.01,-153.2 42.78,-190.54 68.5,-211.25 70.18,-212.6 71.94,-213.89 73.76,-215.1"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="71.57,-217.87 81.97,-219.86 75.07,-211.82 71.57,-217.87"/>
</a>
</g>
</g>
<!-- Node3 -->
<g id="Node000003" class="node">
<title>Node3</title>
<g id="a_Node000003"><a xlink:href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#ab8b6a6aa95db678596bc2a49e864683e" target="_top" xlink:title="returns whether the cache is empty or not">
<polygon fill="white" stroke="#666666" points="210.5,-202.5 78.25,-202.5 78.25,-172 210.5,-172 210.5,-202.5"/>
<text text-anchor="start" x="86.25" y="-189" font-family="Helvetica,sans-Serif" font-size="10.00">others::Cache::LRUCache</text>
<text text-anchor="middle" x="144.38" y="-177.75" font-family="Helvetica,sans-Serif" font-size="10.00">::empty</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node3 -->
<g id="edge2_Node000001_Node000003" class="edge">
<title>Node1&#45;&gt;Node3</title>
<g id="a_edge2_Node000001_Node000003"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M28.34,-135.16C38.26,-143.61 53.52,-155.56 68.5,-163.25 71.2,-164.63 73.99,-165.96 76.84,-167.22"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="75.37,-170.4 85.95,-170.97 78.03,-163.93 75.37,-170.4"/>
</a>
</g>
</g>
<!-- Node4 -->
<g id="Node000004" class="node">
<title>Node4</title>
<g id="a_Node000004"><a xlink:href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#ac1be0357ecc7c34144f3d9a63c6cb3ea" target="_top" xlink:title="get the value of the key&#45;value pair if exists">
<polygon fill="white" stroke="#666666" points="220.25,-153.88 68.5,-153.88 68.5,-134.62 220.25,-134.62 220.25,-153.88"/>
<text text-anchor="middle" x="144.38" y="-140.38" font-family="Helvetica,sans-Serif" font-size="10.00">others::Cache::LRUCache::get</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node4 -->
<g id="edge3_Node000001_Node000004" class="edge">
<title>Node1&#45;&gt;Node4</title>
<g id="a_edge3_Node000001_Node000004"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M32.97,-127.62C41.56,-128.91 52.92,-130.62 65.09,-132.46"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="64.52,-135.91 74.93,-133.94 65.56,-128.99 64.52,-135.91"/>
</a>
</g>
</g>
<!-- Node7 -->
<g id="Node000007" class="node">
<title>Node7</title>
<g id="a_Node000007"><a xlink:href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a5ee34fcee480f21bb6f68a34f0f69b45" target="_top" xlink:title="upsert a key&#45;value pair">
<polygon fill="white" stroke="#666666" points="220.25,-116.88 68.5,-116.88 68.5,-97.62 220.25,-97.62 220.25,-116.88"/>
<text text-anchor="middle" x="144.38" y="-103.38" font-family="Helvetica,sans-Serif" font-size="10.00">others::Cache::LRUCache::put</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node7 -->
<g id="edge6_Node000001_Node000007" class="edge">
<title>Node1&#45;&gt;Node7</title>
<g id="a_edge6_Node000001_Node000007"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M32.97,-123.01C40.74,-121.9 50.78,-120.46 61.63,-118.92"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="61.8,-122.43 71.2,-117.55 60.81,-115.5 61.8,-122.43"/>
</a>
</g>
</g>
<!-- Node9 -->
<g id="Node000009" class="node">
<title>Node9</title>
<g id="a_Node000009"><a xlink:href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a1b709333874b4633ee02a3661cd042e1" target="_top" xlink:title="Returns the number of items present in the cache.">
<polygon fill="white" stroke="#666666" points="210.5,-79.5 78.25,-79.5 78.25,-49 210.5,-49 210.5,-79.5"/>
<text text-anchor="start" x="86.25" y="-66" font-family="Helvetica,sans-Serif" font-size="10.00">others::Cache::LRUCache</text>
<text text-anchor="middle" x="144.38" y="-54.75" font-family="Helvetica,sans-Serif" font-size="10.00">::size</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node9 -->
<g id="edge10_Node000001_Node000009" class="edge">
<title>Node1&#45;&gt;Node9</title>
<g id="a_edge10_Node000001_Node000009"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M28.78,-115.29C38.74,-107.1 53.81,-95.67 68.5,-88.25 71.36,-86.81 74.32,-85.43 77.34,-84.11"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="78.43,-87.45 86.38,-80.45 75.8,-80.96 78.43,-87.45"/>
</a>
</g>
</g>
<!-- Node10 -->
<g id="Node000010" class="node">
<title>Node10</title>
<g id="a_Node000010"><a target="_blank" xlink:href="http://en.cppreference.com/w/cpp/error/exception/what.html#" xlink:title=" ">
<polygon fill="white" stroke="#666666" points="190.62,-30.5 98.12,-30.5 98.12,0 190.62,0 190.62,-30.5"/>
<text text-anchor="start" x="106.12" y="-17" font-family="Helvetica,sans-Serif" font-size="10.00">std::runtime_error</text>
<text text-anchor="middle" x="144.38" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">::what</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node10 -->
<g id="edge11_Node000001_Node000010" class="edge">
<title>Node1&#45;&gt;Node10</title>
<g id="a_edge11_Node000001_Node000010"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M20.62,-115.29C27.09,-97.62 42.94,-60.72 68.5,-40.25 74.25,-35.65 80.89,-31.87 87.78,-28.78"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="88.59,-32.23 96.59,-25.29 86.01,-25.72 88.59,-32.23"/>
</a>
</g>
</g>
<!-- Node5 -->
<g id="Node000005" class="node">
<title>Node5</title>
<g id="a_Node000005"><a xlink:href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#ad022d494b40f82417340b113445e79a4" target="_top" xlink:title="move the existing node in the list to the beginning of the list.">
<polygon fill="white" stroke="#666666" points="388.5,-162.5 256.25,-162.5 256.25,-132 388.5,-132 388.5,-162.5"/>
<text text-anchor="start" x="264.25" y="-149" font-family="Helvetica,sans-Serif" font-size="10.00">others::Cache::LRUCache</text>
<text text-anchor="middle" x="322.38" y="-137.75" font-family="Helvetica,sans-Serif" font-size="10.00">::make_recent</text>
</a>
</g>
</g>
<!-- Node4&#45;&gt;Node5 -->
<g id="edge4_Node000004_Node000005" class="edge">
<title>Node4&#45;&gt;Node5</title>
<g id="a_edge4_Node000004_Node000005"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M220.53,-145.53C228.43,-145.67 236.49,-145.8 244.42,-145.94"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="244.34,-149.44 254.4,-146.11 244.46,-142.44 244.34,-149.44"/>
</a>
</g>
</g>
<!-- Node6 -->
<g id="Node000006" class="node">
<title>Node6</title>
<g id="a_Node000006"><a xlink:href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a2e53b5ad1368d87da501f61473eb9ea2" target="_top" xlink:title="push the node to the front of the linked list.">
<polygon fill="white" stroke="#666666" points="556.75,-140.5 424.5,-140.5 424.5,-110 556.75,-110 556.75,-140.5"/>
<text text-anchor="start" x="432.5" y="-127" font-family="Helvetica,sans-Serif" font-size="10.00">others::Cache::LRUCache</text>
<text text-anchor="middle" x="490.62" y="-115.75" font-family="Helvetica,sans-Serif" font-size="10.00">::push_front</text>
</a>
</g>
</g>
<!-- Node5&#45;&gt;Node6 -->
<g id="edge5_Node000005_Node000006" class="edge">
<title>Node5&#45;&gt;Node6</title>
<g id="a_edge5_Node000005_Node000006"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M388.6,-138.62C396.52,-137.57 404.66,-136.49 412.72,-135.43"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="413.08,-138.91 422.54,-134.13 412.16,-131.97 413.08,-138.91"/>
</a>
</g>
</g>
<!-- Node7&#45;&gt;Node5 -->
<g id="edge7_Node000007_Node000005" class="edge">
<title>Node7&#45;&gt;Node5</title>
<g id="a_edge7_Node000007_Node000005"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M189.79,-117.34C206.56,-121.16 226.15,-125.61 245.02,-129.9"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="244.02,-133.26 254.54,-132.06 245.57,-126.43 244.02,-133.26"/>
</a>
</g>
</g>
<!-- Node7&#45;&gt;Node6 -->
<g id="edge9_Node000007_Node000006" class="edge">
<title>Node7&#45;&gt;Node6</title>
<g id="a_edge9_Node000007_Node000006"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M220.5,-111.18C277.53,-114.16 355.66,-118.25 413.05,-121.25"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="412.55,-124.72 422.72,-121.75 412.92,-117.73 412.55,-124.72"/>
</a>
</g>
</g>
<!-- Node8 -->
<g id="Node000008" class="node">
<title>Node8</title>
<g id="a_Node000008"><a xlink:href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#ab211a4be58491bf11834cae88a0c44f7" target="_top" xlink:title="pop the last node in the linked list.">
<polygon fill="white" stroke="#666666" points="388.5,-76.5 256.25,-76.5 256.25,-46 388.5,-46 388.5,-76.5"/>
<text text-anchor="start" x="264.25" y="-63" font-family="Helvetica,sans-Serif" font-size="10.00">others::Cache::LRUCache</text>
<text text-anchor="middle" x="322.38" y="-51.75" font-family="Helvetica,sans-Serif" font-size="10.00">::pop_back</text>
</a>
</g>
</g>
<!-- Node7&#45;&gt;Node8 -->
<g id="edge8_Node000007_Node000008" class="edge">
<title>Node7&#45;&gt;Node8</title>
<g id="a_edge8_Node000007_Node000008"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M185.42,-97.19C196.69,-94.33 208.96,-91.19 220.25,-88.25 230.56,-85.57 241.45,-82.69 252.12,-79.86"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="252.89,-83.28 261.66,-77.33 251.09,-76.51 252.89,-83.28"/>
</a>
</g>
</g>
</g>
</svg>
<g id="navigator" transform="translate(0 0)" fill="#404254">
<rect fill="#f2f5e9" fill-opacity="0.5" stroke="#606060" stroke-width=".5" x="0" y="0" width="60" height="60"/>
<use id="zoomplus" xlink:href="#zoomPlus" x="17" y="9" onmousedown="handleZoom(evt,'in')"/>
<use id="zoomminus" xlink:href="#zoomMin" x="42" y="9" onmousedown="handleZoom(evt,'out')"/>
<use id="reset" xlink:href="#resetDef" x="30" y="36" onmousedown="handleReset()"/>
<use id="arrowup" xlink:href="#arrowUp" x="0" y="0" onmousedown="handlePan(0,-1)"/>
<use id="arrowright" xlink:href="#arrowRight" x="0" y="0" onmousedown="handlePan(1,0)"/>
<use id="arrowdown" xlink:href="#arrowDown" x="0" y="0" onmousedown="handlePan(0,1)"/>
<use id="arrowleft" xlink:href="#arrowLeft" x="0" y="0" onmousedown="handlePan(-1,0)"/>
</g>
<svg viewBox="0 0 15 15" width="100%" height="30px" preserveAspectRatio="xMaxYMin meet">
<g id="arrow_out" transform="scale(0.3 0.3)">
<a xlink:href="lru__cache2_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph_org.svg" target="_base">
<rect id="button" ry="5" rx="5" y="6" x="6" height="38" width="38"
fill="#f2f5e9" fill-opacity="0.5" stroke="#606060" stroke-width="1.0"/>
<path id="arrow"
d="M 11.500037,31.436501 C 11.940474,20.09759 22.043105,11.32322 32.158766,21.979434 L 37.068811,17.246167 C 37.068811,17.246167 37.088388,32 37.088388,32 L 22.160133,31.978069 C 22.160133,31.978069 26.997745,27.140456 26.997745,27.140456 C 18.528582,18.264221 13.291696,25.230495 11.500037,31.436501 z"
style="fill:#404040;"/>
</a>
</g>
</svg>
<style type='text/css'>
<![CDATA[
[data-mouse-over-selected='false'] { opacity: 0.7; }
[data-mouse-over-selected='true'] { opacity: 1.0; }
]]>
</style>
<script type="application/ecmascript"><![CDATA[
document.addEventListener('DOMContentLoaded', (event) => {
highlightEdges();
highlightAdjacentNodes();
});
]]></script>
</svg>

Before

Width:  |  Height:  |  Size: 14 KiB

View File

@@ -1,208 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 12.1.2 (20240928.0832)
-->
<!-- Title: test Pages: 1 -->
<svg width="565pt" height="260pt"
viewBox="0.00 0.00 564.75 259.50" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 255.5)">
<title>test</title>
<!-- Node1 -->
<g id="Node000001" class="node">
<title>Node1</title>
<g id="a_Node000001"><a xlink:title="self test implementations">
<polygon fill="#999999" stroke="#666666" points="32.5,-134.88 0,-134.88 0,-115.62 32.5,-115.62 32.5,-134.88"/>
<text text-anchor="middle" x="16.25" y="-121.38" font-family="Helvetica,sans-Serif" font-size="10.00">test</text>
</a>
</g>
</g>
<!-- Node2 -->
<g id="Node000002" class="node">
<title>Node2</title>
<g id="a_Node000002"><a xlink:href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#af8edfe5a7def5d5b846463041c33136a" target="_top" xlink:title="Returns the total capacity of the cache.">
<polygon fill="white" stroke="#666666" points="210.5,-251.5 78.25,-251.5 78.25,-221 210.5,-221 210.5,-251.5"/>
<text text-anchor="start" x="86.25" y="-238" font-family="Helvetica,sans-Serif" font-size="10.00">others::Cache::LRUCache</text>
<text text-anchor="middle" x="144.38" y="-226.75" font-family="Helvetica,sans-Serif" font-size="10.00">::capacity</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node2 -->
<g id="edge1_Node000001_Node000002" class="edge">
<title>Node1&#45;&gt;Node2</title>
<g id="a_edge1_Node000001_Node000002"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M20.58,-135.32C27.01,-153.2 42.78,-190.54 68.5,-211.25 70.18,-212.6 71.94,-213.89 73.76,-215.1"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="71.57,-217.87 81.97,-219.86 75.07,-211.82 71.57,-217.87"/>
</a>
</g>
</g>
<!-- Node3 -->
<g id="Node000003" class="node">
<title>Node3</title>
<g id="a_Node000003"><a xlink:href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#ab8b6a6aa95db678596bc2a49e864683e" target="_top" xlink:title="returns whether the cache is empty or not">
<polygon fill="white" stroke="#666666" points="210.5,-202.5 78.25,-202.5 78.25,-172 210.5,-172 210.5,-202.5"/>
<text text-anchor="start" x="86.25" y="-189" font-family="Helvetica,sans-Serif" font-size="10.00">others::Cache::LRUCache</text>
<text text-anchor="middle" x="144.38" y="-177.75" font-family="Helvetica,sans-Serif" font-size="10.00">::empty</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node3 -->
<g id="edge2_Node000001_Node000003" class="edge">
<title>Node1&#45;&gt;Node3</title>
<g id="a_edge2_Node000001_Node000003"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M28.34,-135.16C38.26,-143.61 53.52,-155.56 68.5,-163.25 71.2,-164.63 73.99,-165.96 76.84,-167.22"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="75.37,-170.4 85.95,-170.97 78.03,-163.93 75.37,-170.4"/>
</a>
</g>
</g>
<!-- Node4 -->
<g id="Node000004" class="node">
<title>Node4</title>
<g id="a_Node000004"><a xlink:href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#ac1be0357ecc7c34144f3d9a63c6cb3ea" target="_top" xlink:title="get the value of the key&#45;value pair if exists">
<polygon fill="white" stroke="#666666" points="220.25,-153.88 68.5,-153.88 68.5,-134.62 220.25,-134.62 220.25,-153.88"/>
<text text-anchor="middle" x="144.38" y="-140.38" font-family="Helvetica,sans-Serif" font-size="10.00">others::Cache::LRUCache::get</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node4 -->
<g id="edge3_Node000001_Node000004" class="edge">
<title>Node1&#45;&gt;Node4</title>
<g id="a_edge3_Node000001_Node000004"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M32.97,-127.62C41.56,-128.91 52.92,-130.62 65.09,-132.46"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="64.52,-135.91 74.93,-133.94 65.56,-128.99 64.52,-135.91"/>
</a>
</g>
</g>
<!-- Node7 -->
<g id="Node000007" class="node">
<title>Node7</title>
<g id="a_Node000007"><a xlink:href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a5ee34fcee480f21bb6f68a34f0f69b45" target="_top" xlink:title="upsert a key&#45;value pair">
<polygon fill="white" stroke="#666666" points="220.25,-116.88 68.5,-116.88 68.5,-97.62 220.25,-97.62 220.25,-116.88"/>
<text text-anchor="middle" x="144.38" y="-103.38" font-family="Helvetica,sans-Serif" font-size="10.00">others::Cache::LRUCache::put</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node7 -->
<g id="edge6_Node000001_Node000007" class="edge">
<title>Node1&#45;&gt;Node7</title>
<g id="a_edge6_Node000001_Node000007"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M32.97,-123.01C40.74,-121.9 50.78,-120.46 61.63,-118.92"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="61.8,-122.43 71.2,-117.55 60.81,-115.5 61.8,-122.43"/>
</a>
</g>
</g>
<!-- Node9 -->
<g id="Node000009" class="node">
<title>Node9</title>
<g id="a_Node000009"><a xlink:href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a1b709333874b4633ee02a3661cd042e1" target="_top" xlink:title="Returns the number of items present in the cache.">
<polygon fill="white" stroke="#666666" points="210.5,-79.5 78.25,-79.5 78.25,-49 210.5,-49 210.5,-79.5"/>
<text text-anchor="start" x="86.25" y="-66" font-family="Helvetica,sans-Serif" font-size="10.00">others::Cache::LRUCache</text>
<text text-anchor="middle" x="144.38" y="-54.75" font-family="Helvetica,sans-Serif" font-size="10.00">::size</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node9 -->
<g id="edge10_Node000001_Node000009" class="edge">
<title>Node1&#45;&gt;Node9</title>
<g id="a_edge10_Node000001_Node000009"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M28.78,-115.29C38.74,-107.1 53.81,-95.67 68.5,-88.25 71.36,-86.81 74.32,-85.43 77.34,-84.11"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="78.43,-87.45 86.38,-80.45 75.8,-80.96 78.43,-87.45"/>
</a>
</g>
</g>
<!-- Node10 -->
<g id="Node000010" class="node">
<title>Node10</title>
<g id="a_Node000010"><a target="_blank" xlink:href="http://en.cppreference.com/w/cpp/error/exception/what.html#" xlink:title=" ">
<polygon fill="white" stroke="#666666" points="190.62,-30.5 98.12,-30.5 98.12,0 190.62,0 190.62,-30.5"/>
<text text-anchor="start" x="106.12" y="-17" font-family="Helvetica,sans-Serif" font-size="10.00">std::runtime_error</text>
<text text-anchor="middle" x="144.38" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">::what</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node10 -->
<g id="edge11_Node000001_Node000010" class="edge">
<title>Node1&#45;&gt;Node10</title>
<g id="a_edge11_Node000001_Node000010"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M20.62,-115.29C27.09,-97.62 42.94,-60.72 68.5,-40.25 74.25,-35.65 80.89,-31.87 87.78,-28.78"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="88.59,-32.23 96.59,-25.29 86.01,-25.72 88.59,-32.23"/>
</a>
</g>
</g>
<!-- Node5 -->
<g id="Node000005" class="node">
<title>Node5</title>
<g id="a_Node000005"><a xlink:href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#ad022d494b40f82417340b113445e79a4" target="_top" xlink:title="move the existing node in the list to the beginning of the list.">
<polygon fill="white" stroke="#666666" points="388.5,-162.5 256.25,-162.5 256.25,-132 388.5,-132 388.5,-162.5"/>
<text text-anchor="start" x="264.25" y="-149" font-family="Helvetica,sans-Serif" font-size="10.00">others::Cache::LRUCache</text>
<text text-anchor="middle" x="322.38" y="-137.75" font-family="Helvetica,sans-Serif" font-size="10.00">::make_recent</text>
</a>
</g>
</g>
<!-- Node4&#45;&gt;Node5 -->
<g id="edge4_Node000004_Node000005" class="edge">
<title>Node4&#45;&gt;Node5</title>
<g id="a_edge4_Node000004_Node000005"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M220.53,-145.53C228.43,-145.67 236.49,-145.8 244.42,-145.94"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="244.34,-149.44 254.4,-146.11 244.46,-142.44 244.34,-149.44"/>
</a>
</g>
</g>
<!-- Node6 -->
<g id="Node000006" class="node">
<title>Node6</title>
<g id="a_Node000006"><a xlink:href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a2e53b5ad1368d87da501f61473eb9ea2" target="_top" xlink:title="push the node to the front of the linked list.">
<polygon fill="white" stroke="#666666" points="556.75,-140.5 424.5,-140.5 424.5,-110 556.75,-110 556.75,-140.5"/>
<text text-anchor="start" x="432.5" y="-127" font-family="Helvetica,sans-Serif" font-size="10.00">others::Cache::LRUCache</text>
<text text-anchor="middle" x="490.62" y="-115.75" font-family="Helvetica,sans-Serif" font-size="10.00">::push_front</text>
</a>
</g>
</g>
<!-- Node5&#45;&gt;Node6 -->
<g id="edge5_Node000005_Node000006" class="edge">
<title>Node5&#45;&gt;Node6</title>
<g id="a_edge5_Node000005_Node000006"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M388.6,-138.62C396.52,-137.57 404.66,-136.49 412.72,-135.43"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="413.08,-138.91 422.54,-134.13 412.16,-131.97 413.08,-138.91"/>
</a>
</g>
</g>
<!-- Node7&#45;&gt;Node5 -->
<g id="edge7_Node000007_Node000005" class="edge">
<title>Node7&#45;&gt;Node5</title>
<g id="a_edge7_Node000007_Node000005"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M189.79,-117.34C206.56,-121.16 226.15,-125.61 245.02,-129.9"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="244.02,-133.26 254.54,-132.06 245.57,-126.43 244.02,-133.26"/>
</a>
</g>
</g>
<!-- Node7&#45;&gt;Node6 -->
<g id="edge9_Node000007_Node000006" class="edge">
<title>Node7&#45;&gt;Node6</title>
<g id="a_edge9_Node000007_Node000006"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M220.5,-111.18C277.53,-114.16 355.66,-118.25 413.05,-121.25"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="412.55,-124.72 422.72,-121.75 412.92,-117.73 412.55,-124.72"/>
</a>
</g>
</g>
<!-- Node8 -->
<g id="Node000008" class="node">
<title>Node8</title>
<g id="a_Node000008"><a xlink:href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#ab211a4be58491bf11834cae88a0c44f7" target="_top" xlink:title="pop the last node in the linked list.">
<polygon fill="white" stroke="#666666" points="388.5,-76.5 256.25,-76.5 256.25,-46 388.5,-46 388.5,-76.5"/>
<text text-anchor="start" x="264.25" y="-63" font-family="Helvetica,sans-Serif" font-size="10.00">others::Cache::LRUCache</text>
<text text-anchor="middle" x="322.38" y="-51.75" font-family="Helvetica,sans-Serif" font-size="10.00">::pop_back</text>
</a>
</g>
</g>
<!-- Node7&#45;&gt;Node8 -->
<g id="edge8_Node000007_Node000008" class="edge">
<title>Node7&#45;&gt;Node8</title>
<g id="a_edge8_Node000007_Node000008"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M185.42,-97.19C196.69,-94.33 208.96,-91.19 220.25,-88.25 230.56,-85.57 241.45,-82.69 252.12,-79.86"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="252.89,-83.28 261.66,-77.33 251.09,-76.51 252.89,-83.28"/>
</a>
</g>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 11 KiB

View File

@@ -1,25 +0,0 @@
<map id="main" name="main">
<area shape="rect" id="Node000001" title="main function" alt="" coords="5,161,55,186"/>
<area shape="rect" id="Node000002" href="$dc/daa/lru__cache2_8cpp.html#aa8dca7b867074164d5f45b0f3851269d" title="self test implementations" alt="" coords="103,161,146,186"/>
<area shape="poly" id="edge1_Node000001_Node000002" title=" " alt="" coords="55,171,87,171,87,176,55,176"/>
<area shape="rect" id="Node000003" href="$d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#af8edfe5a7def5d5b846463041c33136a" title="Returns the total capacity of the cache." alt="" coords="207,5,383,46"/>
<area shape="poly" id="edge2_Node000002_Node000003" title=" " alt="" coords="128,159,150,110,169,81,192,57,199,52,203,56,196,61,173,85,155,112,133,161"/>
<area shape="rect" id="Node000004" href="$d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#ab8b6a6aa95db678596bc2a49e864683e" title="returns whether the cache is empty or not" alt="" coords="207,71,383,111"/>
<area shape="poly" id="edge3_Node000002_Node000004" title=" " alt="" coords="139,158,163,139,193,121,204,115,206,120,195,125,166,144,142,163"/>
<area shape="rect" id="Node000005" href="$d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#ac1be0357ecc7c34144f3d9a63c6cb3ea" title="get the value of the key&#45;value pair if exists" alt="" coords="194,136,396,161"/>
<area shape="poly" id="edge4_Node000002_Node000005" title=" " alt="" coords="146,168,189,161,190,167,147,173"/>
<area shape="rect" id="Node000008" href="$d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a5ee34fcee480f21bb6f68a34f0f69b45" title="upsert a key&#45;value pair" alt="" coords="194,185,396,210"/>
<area shape="poly" id="edge7_Node000002_Node000008" title=" " alt="" coords="147,174,185,179,184,185,146,179"/>
<area shape="rect" id="Node000010" href="$d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a1b709333874b4633ee02a3661cd042e1" title="Returns the number of items present in the cache." alt="" coords="207,235,383,275"/>
<area shape="poly" id="edge11_Node000002_Node000010" title=" " alt="" coords="143,185,167,203,195,221,207,226,205,231,193,225,164,208,139,189"/>
<area shape="rect" id="Node000011" href="/Users/runner/work/C-Plus-Plus/C-Plus-Plus/doc/cppreference-doxygen-web.tag.xml$cpp/error/exception/what.html#" title=" " alt="" coords="234,300,357,341"/>
<area shape="poly" id="edge12_Node000002_Node000011" title=" " alt="" coords="133,186,155,234,173,261,196,285,221,300,218,305,192,289,169,265,150,237,128,188"/>
<area shape="rect" id="Node000006" href="$d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#ad022d494b40f82417340b113445e79a4" title="move the existing node in the list to the beginning of the list." alt="" coords="444,124,621,165"/>
<area shape="poly" id="edge5_Node000005_Node000006" title=" " alt="" coords="397,144,429,143,429,149,397,149"/>
<area shape="rect" id="Node000007" href="$d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a2e53b5ad1368d87da501f61473eb9ea2" title="push the node to the front of the linked list." alt="" coords="669,153,845,194"/>
<area shape="poly" id="edge6_Node000006_Node000007" title=" " alt="" coords="621,153,653,157,653,163,620,158"/>
<area shape="poly" id="edge8_Node000008_Node000006" title=" " alt="" coords="355,182,429,165,430,170,356,187"/>
<area shape="poly" id="edge10_Node000008_Node000007" title=" " alt="" coords="397,190,653,176,654,182,397,195"/>
<area shape="rect" id="Node000009" href="$d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#ab211a4be58491bf11834cae88a0c44f7" title="pop the last node in the linked list." alt="" coords="444,239,621,279"/>
<area shape="poly" id="edge9_Node000008_Node000009" title=" " alt="" coords="351,209,397,220,440,232,438,237,396,226,349,214"/>
</map>

View File

@@ -1 +0,0 @@
70630744275453827fd653376a53c592

View File

@@ -1,309 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 12.1.2 (20240928.0832)
-->
<!-- Title: main Pages: 1 -->
<!--zoomable 260 -->
<svg id="main" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" onload="init(evt)">
<style type="text/css"><![CDATA[
.node, .edge {opacity: 0.7;}
.node.selected, .edge.selected {opacity: 1;}
.edge:hover path { stroke: red; }
.edge:hover polygon { stroke: red; fill: red; }
]]></style>
<defs>
<circle id="rim" cx="0" cy="0" r="7"/>
<circle id="rim2" cx="0" cy="0" r="3.5"/>
<g id="zoomPlus">
<use xlink:href="#rim" fill="#404040"><set attributeName="fill" to="#808080" begin="zoomplus.mouseover" end="zoomplus.mouseout"/></use>
<path d="M-4,0h8M0,-4v8" fill="none" stroke="white" stroke-width="1.5" pointer-events="none"/>
</g>
<g id="zoomMin">
<use xlink:href="#rim" fill="#404040"><set attributeName="fill" to="#808080" begin="zoomminus.mouseover" end="zoomminus.mouseout"/></use>
<path d="M-4,0h8" fill="none" stroke="white" stroke-width="1.5" pointer-events="none"/>
</g>
<g id="arrowUp" transform="translate(30 24)">
<use xlink:href="#rim"/>
<path pointer-events="none" fill="none" stroke="white" stroke-width="1.5" d="M0,-3.0v7 M-2.5,-0.5L0,-3.0L2.5,-0.5"/>
</g>
<g id="arrowRight" transform="rotate(90) translate(36 -43)">
<use xlink:href="#rim"/>
<path pointer-events="none" fill="none" stroke="white" stroke-width="1.5" d="M0,-3.0v7 M-2.5,-0.5L0,-3.0L2.5,-0.5"/>
</g>
<g id="arrowDown" transform="rotate(180) translate(-30 -48)">
<use xlink:href="#rim"/>
<path pointer-events="none" fill="none" stroke="white" stroke-width="1.5" d="M0,-3.0v7 M-2.5,-0.5L0,-3.0L2.5,-0.5"/>
</g>
<g id="arrowLeft" transform="rotate(270) translate(-36 17)">
<use xlink:href="#rim"/>
<path pointer-events="none" fill="none" stroke="white" stroke-width="1.5" d="M0,-3.0v7 M-2.5,-0.5L0,-3.0L2.5,-0.5"/>
</g>
<g id="resetDef">
<use xlink:href="#rim2" fill="#404040"><set attributeName="fill" to="#808080" begin="reset.mouseover" end="reset.mouseout"/></use>
</g>
</defs>
<script type="application/ecmascript">
var viewWidth = 638;
var viewHeight = 260;
var sectionId = 'dynsection-1';
</script>
<script type="application/ecmascript" xlink:href="../../svg.min.js"/>
<svg id="graph" class="graph">
<g id="viewport">
<title>main</title>
<!-- Node1 -->
<g id="Node000001" class="node">
<title>Node1</title>
<g id="a_Node000001"><a xlink:title="main function">
<polygon fill="#999999" stroke="#666666" points="37,-134.88 0,-134.88 0,-115.62 37,-115.62 37,-134.88"/>
<text text-anchor="middle" x="18.5" y="-121.38" font-family="Helvetica,sans-Serif" font-size="10.00">main</text>
</a>
</g>
</g>
<!-- Node2 -->
<g id="Node000002" class="node">
<title>Node2</title>
<g id="a_Node000002"><a xlink:href="../../dc/daa/lru__cache2_8cpp.html#aa8dca7b867074164d5f45b0f3851269d" target="_top" xlink:title="self test implementations">
<polygon fill="white" stroke="#666666" points="105.5,-134.88 73,-134.88 73,-115.62 105.5,-115.62 105.5,-134.88"/>
<text text-anchor="middle" x="89.25" y="-121.38" font-family="Helvetica,sans-Serif" font-size="10.00">test</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node2 -->
<g id="edge1_Node000001_Node000002" class="edge">
<title>Node1&#45;&gt;Node2</title>
<g id="a_edge1_Node000001_Node000002"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M37.2,-125.25C44.58,-125.25 53.31,-125.25 61.45,-125.25"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="61.2,-128.75 71.2,-125.25 61.2,-121.75 61.2,-128.75"/>
</a>
</g>
</g>
<!-- Node3 -->
<g id="Node000003" class="node">
<title>Node3</title>
<g id="a_Node000003"><a xlink:href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#af8edfe5a7def5d5b846463041c33136a" target="_top" xlink:title="Returns the total capacity of the cache.">
<polygon fill="white" stroke="#666666" points="283.5,-251.5 151.25,-251.5 151.25,-221 283.5,-221 283.5,-251.5"/>
<text text-anchor="start" x="159.25" y="-238" font-family="Helvetica,sans-Serif" font-size="10.00">others::Cache::LRUCache</text>
<text text-anchor="middle" x="217.38" y="-226.75" font-family="Helvetica,sans-Serif" font-size="10.00">::capacity</text>
</a>
</g>
</g>
<!-- Node2&#45;&gt;Node3 -->
<g id="edge2_Node000002_Node000003" class="edge">
<title>Node2&#45;&gt;Node3</title>
<g id="a_edge2_Node000002_Node000003"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M93.58,-135.32C100.01,-153.2 115.78,-190.54 141.5,-211.25 143.18,-212.6 144.94,-213.89 146.76,-215.1"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="144.57,-217.87 154.97,-219.86 148.07,-211.82 144.57,-217.87"/>
</a>
</g>
</g>
<!-- Node4 -->
<g id="Node000004" class="node">
<title>Node4</title>
<g id="a_Node000004"><a xlink:href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#ab8b6a6aa95db678596bc2a49e864683e" target="_top" xlink:title="returns whether the cache is empty or not">
<polygon fill="white" stroke="#666666" points="283.5,-202.5 151.25,-202.5 151.25,-172 283.5,-172 283.5,-202.5"/>
<text text-anchor="start" x="159.25" y="-189" font-family="Helvetica,sans-Serif" font-size="10.00">others::Cache::LRUCache</text>
<text text-anchor="middle" x="217.38" y="-177.75" font-family="Helvetica,sans-Serif" font-size="10.00">::empty</text>
</a>
</g>
</g>
<!-- Node2&#45;&gt;Node4 -->
<g id="edge3_Node000002_Node000004" class="edge">
<title>Node2&#45;&gt;Node4</title>
<g id="a_edge3_Node000002_Node000004"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M101.34,-135.16C111.26,-143.61 126.52,-155.56 141.5,-163.25 144.2,-164.63 146.99,-165.96 149.84,-167.22"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="148.37,-170.4 158.95,-170.97 151.03,-163.93 148.37,-170.4"/>
</a>
</g>
</g>
<!-- Node5 -->
<g id="Node000005" class="node">
<title>Node5</title>
<g id="a_Node000005"><a xlink:href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#ac1be0357ecc7c34144f3d9a63c6cb3ea" target="_top" xlink:title="get the value of the key&#45;value pair if exists">
<polygon fill="white" stroke="#666666" points="293.25,-153.88 141.5,-153.88 141.5,-134.62 293.25,-134.62 293.25,-153.88"/>
<text text-anchor="middle" x="217.38" y="-140.38" font-family="Helvetica,sans-Serif" font-size="10.00">others::Cache::LRUCache::get</text>
</a>
</g>
</g>
<!-- Node2&#45;&gt;Node5 -->
<g id="edge4_Node000002_Node000005" class="edge">
<title>Node2&#45;&gt;Node5</title>
<g id="a_edge4_Node000002_Node000005"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M105.97,-127.62C114.56,-128.91 125.92,-130.62 138.09,-132.46"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="137.52,-135.91 147.93,-133.94 138.56,-128.99 137.52,-135.91"/>
</a>
</g>
</g>
<!-- Node8 -->
<g id="Node000008" class="node">
<title>Node8</title>
<g id="a_Node000008"><a xlink:href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a5ee34fcee480f21bb6f68a34f0f69b45" target="_top" xlink:title="upsert a key&#45;value pair">
<polygon fill="white" stroke="#666666" points="293.25,-116.88 141.5,-116.88 141.5,-97.62 293.25,-97.62 293.25,-116.88"/>
<text text-anchor="middle" x="217.38" y="-103.38" font-family="Helvetica,sans-Serif" font-size="10.00">others::Cache::LRUCache::put</text>
</a>
</g>
</g>
<!-- Node2&#45;&gt;Node8 -->
<g id="edge7_Node000002_Node000008" class="edge">
<title>Node2&#45;&gt;Node8</title>
<g id="a_edge7_Node000002_Node000008"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M105.97,-123.01C113.74,-121.9 123.78,-120.46 134.63,-118.92"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="134.8,-122.43 144.2,-117.55 133.81,-115.5 134.8,-122.43"/>
</a>
</g>
</g>
<!-- Node10 -->
<g id="Node000010" class="node">
<title>Node10</title>
<g id="a_Node000010"><a xlink:href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a1b709333874b4633ee02a3661cd042e1" target="_top" xlink:title="Returns the number of items present in the cache.">
<polygon fill="white" stroke="#666666" points="283.5,-79.5 151.25,-79.5 151.25,-49 283.5,-49 283.5,-79.5"/>
<text text-anchor="start" x="159.25" y="-66" font-family="Helvetica,sans-Serif" font-size="10.00">others::Cache::LRUCache</text>
<text text-anchor="middle" x="217.38" y="-54.75" font-family="Helvetica,sans-Serif" font-size="10.00">::size</text>
</a>
</g>
</g>
<!-- Node2&#45;&gt;Node10 -->
<g id="edge11_Node000002_Node000010" class="edge">
<title>Node2&#45;&gt;Node10</title>
<g id="a_edge11_Node000002_Node000010"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M101.78,-115.29C111.74,-107.1 126.81,-95.67 141.5,-88.25 144.36,-86.81 147.32,-85.43 150.34,-84.11"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="151.43,-87.45 159.38,-80.45 148.8,-80.96 151.43,-87.45"/>
</a>
</g>
</g>
<!-- Node11 -->
<g id="Node000011" class="node">
<title>Node11</title>
<g id="a_Node000011"><a target="_blank" xlink:href="http://en.cppreference.com/w/cpp/error/exception/what.html#" xlink:title=" ">
<polygon fill="white" stroke="#666666" points="263.62,-30.5 171.12,-30.5 171.12,0 263.62,0 263.62,-30.5"/>
<text text-anchor="start" x="179.12" y="-17" font-family="Helvetica,sans-Serif" font-size="10.00">std::runtime_error</text>
<text text-anchor="middle" x="217.38" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">::what</text>
</a>
</g>
</g>
<!-- Node2&#45;&gt;Node11 -->
<g id="edge12_Node000002_Node000011" class="edge">
<title>Node2&#45;&gt;Node11</title>
<g id="a_edge12_Node000002_Node000011"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M93.62,-115.29C100.09,-97.62 115.94,-60.72 141.5,-40.25 147.25,-35.65 153.89,-31.87 160.78,-28.78"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="161.59,-32.23 169.59,-25.29 159.01,-25.72 161.59,-32.23"/>
</a>
</g>
</g>
<!-- Node6 -->
<g id="Node000006" class="node">
<title>Node6</title>
<g id="a_Node000006"><a xlink:href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#ad022d494b40f82417340b113445e79a4" target="_top" xlink:title="move the existing node in the list to the beginning of the list.">
<polygon fill="white" stroke="#666666" points="461.5,-162.5 329.25,-162.5 329.25,-132 461.5,-132 461.5,-162.5"/>
<text text-anchor="start" x="337.25" y="-149" font-family="Helvetica,sans-Serif" font-size="10.00">others::Cache::LRUCache</text>
<text text-anchor="middle" x="395.38" y="-137.75" font-family="Helvetica,sans-Serif" font-size="10.00">::make_recent</text>
</a>
</g>
</g>
<!-- Node5&#45;&gt;Node6 -->
<g id="edge5_Node000005_Node000006" class="edge">
<title>Node5&#45;&gt;Node6</title>
<g id="a_edge5_Node000005_Node000006"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M293.53,-145.53C301.43,-145.67 309.49,-145.8 317.42,-145.94"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="317.34,-149.44 327.4,-146.11 317.46,-142.44 317.34,-149.44"/>
</a>
</g>
</g>
<!-- Node7 -->
<g id="Node000007" class="node">
<title>Node7</title>
<g id="a_Node000007"><a xlink:href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a2e53b5ad1368d87da501f61473eb9ea2" target="_top" xlink:title="push the node to the front of the linked list.">
<polygon fill="white" stroke="#666666" points="629.75,-140.5 497.5,-140.5 497.5,-110 629.75,-110 629.75,-140.5"/>
<text text-anchor="start" x="505.5" y="-127" font-family="Helvetica,sans-Serif" font-size="10.00">others::Cache::LRUCache</text>
<text text-anchor="middle" x="563.62" y="-115.75" font-family="Helvetica,sans-Serif" font-size="10.00">::push_front</text>
</a>
</g>
</g>
<!-- Node6&#45;&gt;Node7 -->
<g id="edge6_Node000006_Node000007" class="edge">
<title>Node6&#45;&gt;Node7</title>
<g id="a_edge6_Node000006_Node000007"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M461.6,-138.62C469.52,-137.57 477.66,-136.49 485.72,-135.43"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="486.08,-138.91 495.54,-134.13 485.16,-131.97 486.08,-138.91"/>
</a>
</g>
</g>
<!-- Node8&#45;&gt;Node6 -->
<g id="edge8_Node000008_Node000006" class="edge">
<title>Node8&#45;&gt;Node6</title>
<g id="a_edge8_Node000008_Node000006"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M262.79,-117.34C279.56,-121.16 299.15,-125.61 318.02,-129.9"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="317.02,-133.26 327.54,-132.06 318.57,-126.43 317.02,-133.26"/>
</a>
</g>
</g>
<!-- Node8&#45;&gt;Node7 -->
<g id="edge10_Node000008_Node000007" class="edge">
<title>Node8&#45;&gt;Node7</title>
<g id="a_edge10_Node000008_Node000007"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M293.5,-111.18C350.53,-114.16 428.66,-118.25 486.05,-121.25"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="485.55,-124.72 495.72,-121.75 485.92,-117.73 485.55,-124.72"/>
</a>
</g>
</g>
<!-- Node9 -->
<g id="Node000009" class="node">
<title>Node9</title>
<g id="a_Node000009"><a xlink:href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#ab211a4be58491bf11834cae88a0c44f7" target="_top" xlink:title="pop the last node in the linked list.">
<polygon fill="white" stroke="#666666" points="461.5,-76.5 329.25,-76.5 329.25,-46 461.5,-46 461.5,-76.5"/>
<text text-anchor="start" x="337.25" y="-63" font-family="Helvetica,sans-Serif" font-size="10.00">others::Cache::LRUCache</text>
<text text-anchor="middle" x="395.38" y="-51.75" font-family="Helvetica,sans-Serif" font-size="10.00">::pop_back</text>
</a>
</g>
</g>
<!-- Node8&#45;&gt;Node9 -->
<g id="edge9_Node000008_Node000009" class="edge">
<title>Node8&#45;&gt;Node9</title>
<g id="a_edge9_Node000008_Node000009"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M258.42,-97.19C269.69,-94.33 281.96,-91.19 293.25,-88.25 303.56,-85.57 314.45,-82.69 325.12,-79.86"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="325.89,-83.28 334.66,-77.33 324.09,-76.51 325.89,-83.28"/>
</a>
</g>
</g>
</g>
</svg>
<g id="navigator" transform="translate(0 0)" fill="#404254">
<rect fill="#f2f5e9" fill-opacity="0.5" stroke="#606060" stroke-width=".5" x="0" y="0" width="60" height="60"/>
<use id="zoomplus" xlink:href="#zoomPlus" x="17" y="9" onmousedown="handleZoom(evt,'in')"/>
<use id="zoomminus" xlink:href="#zoomMin" x="42" y="9" onmousedown="handleZoom(evt,'out')"/>
<use id="reset" xlink:href="#resetDef" x="30" y="36" onmousedown="handleReset()"/>
<use id="arrowup" xlink:href="#arrowUp" x="0" y="0" onmousedown="handlePan(0,-1)"/>
<use id="arrowright" xlink:href="#arrowRight" x="0" y="0" onmousedown="handlePan(1,0)"/>
<use id="arrowdown" xlink:href="#arrowDown" x="0" y="0" onmousedown="handlePan(0,1)"/>
<use id="arrowleft" xlink:href="#arrowLeft" x="0" y="0" onmousedown="handlePan(-1,0)"/>
</g>
<svg viewBox="0 0 15 15" width="100%" height="30px" preserveAspectRatio="xMaxYMin meet">
<g id="arrow_out" transform="scale(0.3 0.3)">
<a xlink:href="lru__cache2_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph_org.svg" target="_base">
<rect id="button" ry="5" rx="5" y="6" x="6" height="38" width="38"
fill="#f2f5e9" fill-opacity="0.5" stroke="#606060" stroke-width="1.0"/>
<path id="arrow"
d="M 11.500037,31.436501 C 11.940474,20.09759 22.043105,11.32322 32.158766,21.979434 L 37.068811,17.246167 C 37.068811,17.246167 37.088388,32 37.088388,32 L 22.160133,31.978069 C 22.160133,31.978069 26.997745,27.140456 26.997745,27.140456 C 18.528582,18.264221 13.291696,25.230495 11.500037,31.436501 z"
style="fill:#404040;"/>
</a>
</g>
</svg>
<style type='text/css'>
<![CDATA[
[data-mouse-over-selected='false'] { opacity: 0.7; }
[data-mouse-over-selected='true'] { opacity: 1.0; }
]]>
</style>
<script type="application/ecmascript"><![CDATA[
document.addEventListener('DOMContentLoaded', (event) => {
highlightEdges();
highlightAdjacentNodes();
});
]]></script>
</svg>

Before

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -1,226 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 12.1.2 (20240928.0832)
-->
<!-- Title: main Pages: 1 -->
<svg width="638pt" height="260pt"
viewBox="0.00 0.00 637.75 259.50" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 255.5)">
<title>main</title>
<!-- Node1 -->
<g id="Node000001" class="node">
<title>Node1</title>
<g id="a_Node000001"><a xlink:title="main function">
<polygon fill="#999999" stroke="#666666" points="37,-134.88 0,-134.88 0,-115.62 37,-115.62 37,-134.88"/>
<text text-anchor="middle" x="18.5" y="-121.38" font-family="Helvetica,sans-Serif" font-size="10.00">main</text>
</a>
</g>
</g>
<!-- Node2 -->
<g id="Node000002" class="node">
<title>Node2</title>
<g id="a_Node000002"><a xlink:href="../../dc/daa/lru__cache2_8cpp.html#aa8dca7b867074164d5f45b0f3851269d" target="_top" xlink:title="self test implementations">
<polygon fill="white" stroke="#666666" points="105.5,-134.88 73,-134.88 73,-115.62 105.5,-115.62 105.5,-134.88"/>
<text text-anchor="middle" x="89.25" y="-121.38" font-family="Helvetica,sans-Serif" font-size="10.00">test</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node2 -->
<g id="edge1_Node000001_Node000002" class="edge">
<title>Node1&#45;&gt;Node2</title>
<g id="a_edge1_Node000001_Node000002"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M37.2,-125.25C44.58,-125.25 53.31,-125.25 61.45,-125.25"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="61.2,-128.75 71.2,-125.25 61.2,-121.75 61.2,-128.75"/>
</a>
</g>
</g>
<!-- Node3 -->
<g id="Node000003" class="node">
<title>Node3</title>
<g id="a_Node000003"><a xlink:href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#af8edfe5a7def5d5b846463041c33136a" target="_top" xlink:title="Returns the total capacity of the cache.">
<polygon fill="white" stroke="#666666" points="283.5,-251.5 151.25,-251.5 151.25,-221 283.5,-221 283.5,-251.5"/>
<text text-anchor="start" x="159.25" y="-238" font-family="Helvetica,sans-Serif" font-size="10.00">others::Cache::LRUCache</text>
<text text-anchor="middle" x="217.38" y="-226.75" font-family="Helvetica,sans-Serif" font-size="10.00">::capacity</text>
</a>
</g>
</g>
<!-- Node2&#45;&gt;Node3 -->
<g id="edge2_Node000002_Node000003" class="edge">
<title>Node2&#45;&gt;Node3</title>
<g id="a_edge2_Node000002_Node000003"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M93.58,-135.32C100.01,-153.2 115.78,-190.54 141.5,-211.25 143.18,-212.6 144.94,-213.89 146.76,-215.1"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="144.57,-217.87 154.97,-219.86 148.07,-211.82 144.57,-217.87"/>
</a>
</g>
</g>
<!-- Node4 -->
<g id="Node000004" class="node">
<title>Node4</title>
<g id="a_Node000004"><a xlink:href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#ab8b6a6aa95db678596bc2a49e864683e" target="_top" xlink:title="returns whether the cache is empty or not">
<polygon fill="white" stroke="#666666" points="283.5,-202.5 151.25,-202.5 151.25,-172 283.5,-172 283.5,-202.5"/>
<text text-anchor="start" x="159.25" y="-189" font-family="Helvetica,sans-Serif" font-size="10.00">others::Cache::LRUCache</text>
<text text-anchor="middle" x="217.38" y="-177.75" font-family="Helvetica,sans-Serif" font-size="10.00">::empty</text>
</a>
</g>
</g>
<!-- Node2&#45;&gt;Node4 -->
<g id="edge3_Node000002_Node000004" class="edge">
<title>Node2&#45;&gt;Node4</title>
<g id="a_edge3_Node000002_Node000004"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M101.34,-135.16C111.26,-143.61 126.52,-155.56 141.5,-163.25 144.2,-164.63 146.99,-165.96 149.84,-167.22"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="148.37,-170.4 158.95,-170.97 151.03,-163.93 148.37,-170.4"/>
</a>
</g>
</g>
<!-- Node5 -->
<g id="Node000005" class="node">
<title>Node5</title>
<g id="a_Node000005"><a xlink:href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#ac1be0357ecc7c34144f3d9a63c6cb3ea" target="_top" xlink:title="get the value of the key&#45;value pair if exists">
<polygon fill="white" stroke="#666666" points="293.25,-153.88 141.5,-153.88 141.5,-134.62 293.25,-134.62 293.25,-153.88"/>
<text text-anchor="middle" x="217.38" y="-140.38" font-family="Helvetica,sans-Serif" font-size="10.00">others::Cache::LRUCache::get</text>
</a>
</g>
</g>
<!-- Node2&#45;&gt;Node5 -->
<g id="edge4_Node000002_Node000005" class="edge">
<title>Node2&#45;&gt;Node5</title>
<g id="a_edge4_Node000002_Node000005"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M105.97,-127.62C114.56,-128.91 125.92,-130.62 138.09,-132.46"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="137.52,-135.91 147.93,-133.94 138.56,-128.99 137.52,-135.91"/>
</a>
</g>
</g>
<!-- Node8 -->
<g id="Node000008" class="node">
<title>Node8</title>
<g id="a_Node000008"><a xlink:href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a5ee34fcee480f21bb6f68a34f0f69b45" target="_top" xlink:title="upsert a key&#45;value pair">
<polygon fill="white" stroke="#666666" points="293.25,-116.88 141.5,-116.88 141.5,-97.62 293.25,-97.62 293.25,-116.88"/>
<text text-anchor="middle" x="217.38" y="-103.38" font-family="Helvetica,sans-Serif" font-size="10.00">others::Cache::LRUCache::put</text>
</a>
</g>
</g>
<!-- Node2&#45;&gt;Node8 -->
<g id="edge7_Node000002_Node000008" class="edge">
<title>Node2&#45;&gt;Node8</title>
<g id="a_edge7_Node000002_Node000008"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M105.97,-123.01C113.74,-121.9 123.78,-120.46 134.63,-118.92"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="134.8,-122.43 144.2,-117.55 133.81,-115.5 134.8,-122.43"/>
</a>
</g>
</g>
<!-- Node10 -->
<g id="Node000010" class="node">
<title>Node10</title>
<g id="a_Node000010"><a xlink:href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a1b709333874b4633ee02a3661cd042e1" target="_top" xlink:title="Returns the number of items present in the cache.">
<polygon fill="white" stroke="#666666" points="283.5,-79.5 151.25,-79.5 151.25,-49 283.5,-49 283.5,-79.5"/>
<text text-anchor="start" x="159.25" y="-66" font-family="Helvetica,sans-Serif" font-size="10.00">others::Cache::LRUCache</text>
<text text-anchor="middle" x="217.38" y="-54.75" font-family="Helvetica,sans-Serif" font-size="10.00">::size</text>
</a>
</g>
</g>
<!-- Node2&#45;&gt;Node10 -->
<g id="edge11_Node000002_Node000010" class="edge">
<title>Node2&#45;&gt;Node10</title>
<g id="a_edge11_Node000002_Node000010"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M101.78,-115.29C111.74,-107.1 126.81,-95.67 141.5,-88.25 144.36,-86.81 147.32,-85.43 150.34,-84.11"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="151.43,-87.45 159.38,-80.45 148.8,-80.96 151.43,-87.45"/>
</a>
</g>
</g>
<!-- Node11 -->
<g id="Node000011" class="node">
<title>Node11</title>
<g id="a_Node000011"><a target="_blank" xlink:href="http://en.cppreference.com/w/cpp/error/exception/what.html#" xlink:title=" ">
<polygon fill="white" stroke="#666666" points="263.62,-30.5 171.12,-30.5 171.12,0 263.62,0 263.62,-30.5"/>
<text text-anchor="start" x="179.12" y="-17" font-family="Helvetica,sans-Serif" font-size="10.00">std::runtime_error</text>
<text text-anchor="middle" x="217.38" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">::what</text>
</a>
</g>
</g>
<!-- Node2&#45;&gt;Node11 -->
<g id="edge12_Node000002_Node000011" class="edge">
<title>Node2&#45;&gt;Node11</title>
<g id="a_edge12_Node000002_Node000011"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M93.62,-115.29C100.09,-97.62 115.94,-60.72 141.5,-40.25 147.25,-35.65 153.89,-31.87 160.78,-28.78"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="161.59,-32.23 169.59,-25.29 159.01,-25.72 161.59,-32.23"/>
</a>
</g>
</g>
<!-- Node6 -->
<g id="Node000006" class="node">
<title>Node6</title>
<g id="a_Node000006"><a xlink:href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#ad022d494b40f82417340b113445e79a4" target="_top" xlink:title="move the existing node in the list to the beginning of the list.">
<polygon fill="white" stroke="#666666" points="461.5,-162.5 329.25,-162.5 329.25,-132 461.5,-132 461.5,-162.5"/>
<text text-anchor="start" x="337.25" y="-149" font-family="Helvetica,sans-Serif" font-size="10.00">others::Cache::LRUCache</text>
<text text-anchor="middle" x="395.38" y="-137.75" font-family="Helvetica,sans-Serif" font-size="10.00">::make_recent</text>
</a>
</g>
</g>
<!-- Node5&#45;&gt;Node6 -->
<g id="edge5_Node000005_Node000006" class="edge">
<title>Node5&#45;&gt;Node6</title>
<g id="a_edge5_Node000005_Node000006"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M293.53,-145.53C301.43,-145.67 309.49,-145.8 317.42,-145.94"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="317.34,-149.44 327.4,-146.11 317.46,-142.44 317.34,-149.44"/>
</a>
</g>
</g>
<!-- Node7 -->
<g id="Node000007" class="node">
<title>Node7</title>
<g id="a_Node000007"><a xlink:href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a2e53b5ad1368d87da501f61473eb9ea2" target="_top" xlink:title="push the node to the front of the linked list.">
<polygon fill="white" stroke="#666666" points="629.75,-140.5 497.5,-140.5 497.5,-110 629.75,-110 629.75,-140.5"/>
<text text-anchor="start" x="505.5" y="-127" font-family="Helvetica,sans-Serif" font-size="10.00">others::Cache::LRUCache</text>
<text text-anchor="middle" x="563.62" y="-115.75" font-family="Helvetica,sans-Serif" font-size="10.00">::push_front</text>
</a>
</g>
</g>
<!-- Node6&#45;&gt;Node7 -->
<g id="edge6_Node000006_Node000007" class="edge">
<title>Node6&#45;&gt;Node7</title>
<g id="a_edge6_Node000006_Node000007"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M461.6,-138.62C469.52,-137.57 477.66,-136.49 485.72,-135.43"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="486.08,-138.91 495.54,-134.13 485.16,-131.97 486.08,-138.91"/>
</a>
</g>
</g>
<!-- Node8&#45;&gt;Node6 -->
<g id="edge8_Node000008_Node000006" class="edge">
<title>Node8&#45;&gt;Node6</title>
<g id="a_edge8_Node000008_Node000006"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M262.79,-117.34C279.56,-121.16 299.15,-125.61 318.02,-129.9"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="317.02,-133.26 327.54,-132.06 318.57,-126.43 317.02,-133.26"/>
</a>
</g>
</g>
<!-- Node8&#45;&gt;Node7 -->
<g id="edge10_Node000008_Node000007" class="edge">
<title>Node8&#45;&gt;Node7</title>
<g id="a_edge10_Node000008_Node000007"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M293.5,-111.18C350.53,-114.16 428.66,-118.25 486.05,-121.25"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="485.55,-124.72 495.72,-121.75 485.92,-117.73 485.55,-124.72"/>
</a>
</g>
</g>
<!-- Node9 -->
<g id="Node000009" class="node">
<title>Node9</title>
<g id="a_Node000009"><a xlink:href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#ab211a4be58491bf11834cae88a0c44f7" target="_top" xlink:title="pop the last node in the linked list.">
<polygon fill="white" stroke="#666666" points="461.5,-76.5 329.25,-76.5 329.25,-46 461.5,-46 461.5,-76.5"/>
<text text-anchor="start" x="337.25" y="-63" font-family="Helvetica,sans-Serif" font-size="10.00">others::Cache::LRUCache</text>
<text text-anchor="middle" x="395.38" y="-51.75" font-family="Helvetica,sans-Serif" font-size="10.00">::pop_back</text>
</a>
</g>
</g>
<!-- Node8&#45;&gt;Node9 -->
<g id="edge9_Node000008_Node000009" class="edge">
<title>Node8&#45;&gt;Node9</title>
<g id="a_edge9_Node000008_Node000009"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M258.42,-97.19C269.69,-94.33 281.96,-91.19 293.25,-88.25 303.56,-85.57 314.45,-82.69 325.12,-79.86"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="325.89,-83.28 334.66,-77.33 324.09,-76.51 325.89,-83.28"/>
</a>
</g>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 12 KiB

View File

@@ -0,0 +1,371 @@
<!-- HTML header for doxygen 1.12.0-->
<!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.12.0"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>TheAlgorithms/C++: others/lru_cache2.cpp Source File</title>
<link rel="icon" href="../../favicon.svg" type="image/x-icon" />
<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>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@xpack-3rd-party/doxygen-awesome-css@2.2.0-1/doxygen-awesome-darkmode-toggle.js"></script>
<script type="text/javascript">
DoxygenAwesomeDarkModeToggle.init()
</script>
<script type="text/javascript" src="../../clipboard.js"></script>
<link href="../../navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../navtreedata.js"></script>
<script type="text/javascript" src="../../navtree.js"></script>
<script type="text/javascript" src="../../resize.js"></script>
<script type="text/javascript" src="../../cookie.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>
<script type="text/javascript">
window.MathJax = {
options: {
ignoreHtmlClass: 'tex2jax_ignore',
processHtmlClass: 'tex2jax_process'
},
loader: {
load: ['[tex]/ams']
},
tex: {
macros: {},
packages: ['base','configmacros','ams']
}
};
</script>
<script type="text/javascript" id="MathJax-script" async="async" src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js"></script>
<link href="../../doxygen.css" rel="stylesheet" type="text/css" />
<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="projectlogo"><img alt="Logo" src="../../project_logo.png"/></td>
<td id="projectalign">
<div id="projectname">TheAlgorithms/C++<span id="projectnumber">&#160;1.0.0</span>
</div>
<div id="projectbrief">All the algorithms implemented in C++</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.12.0 -->
<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">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() { codefold.init(1); });
/* @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',true);
$(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function(){initNavTree('dc/daa/lru__cache2_8cpp_source.html','../../'); initResizable(true); });
/* @license-end */
</script>
<div id="doc-content">
<!-- 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 class="header">
<div class="headertitle"><div class="title">lru_cache2.cpp</div></div>
</div><!--header-->
<div class="contents">
<a href="../../dc/daa/lru__cache2_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno"> 1</span> </div>
<div class="line"><a id="l00019" name="l00019"></a><span class="lineno"> 19</span><span class="preprocessor">#include &lt;cassert&gt;</span> <span class="comment">// for assert</span></div>
<div class="line"><a id="l00020" name="l00020"></a><span class="lineno"> 20</span><span class="preprocessor">#include &lt;cstdint&gt;</span> <span class="comment">// for std::uint32_t</span></div>
<div class="line"><a id="l00021" name="l00021"></a><span class="lineno"> 21</span><span class="preprocessor">#include &lt;iostream&gt;</span> <span class="comment">// for std::cout</span></div>
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno"> 22</span><span class="preprocessor">#include &lt;unordered_map&gt;</span> <span class="comment">// for std::unordered_map</span></div>
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno"> 23</span> </div>
<div class="line"><a id="l00028" name="l00028"></a><span class="lineno"> 28</span><span class="keyword">namespace </span><a class="code hl_namespace" href="../../d0/d6f/namespaceothers.html">others</a> {</div>
<div class="line"><a id="l00029" name="l00029"></a><span class="lineno"> 29</span> </div>
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno"> 34</span><span class="keyword">namespace </span>Cache {</div>
<div class="line"><a id="l00035" name="l00035"></a><span class="lineno"> 35</span> </div>
<div class="line"><a id="l00041" name="l00041"></a><span class="lineno"> 41</span><span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
<div class="foldopen" id="foldopen00042" data-start="{" data-end="};">
<div class="line"><a id="l00042" name="l00042"></a><span class="lineno"><a class="line" href="../../de/d21/classothers_1_1_cache_1_1_d___node.html"> 42</a></span><span class="keyword">class </span><a class="code hl_class" href="../../de/d21/classothers_1_1_cache_1_1_d___node.html">D_Node</a> {</div>
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno"> 43</span> <span class="keyword">public</span>:</div>
<div class="line"><a id="l00044" name="l00044"></a><span class="lineno"> 44</span> T <a class="code hl_variable" href="../../de/d21/classothers_1_1_cache_1_1_d___node.html#a8902e7ff872fa3c80fe6ce5f5cf5cc75">data</a>; </div>
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno"> 45</span> <a class="code hl_class" href="../../de/d21/classothers_1_1_cache_1_1_d___node.html">D_Node&lt;T&gt;</a> *<a class="code hl_variable" href="../../de/d21/classothers_1_1_cache_1_1_d___node.html#a19e954cbb710ea8318bcb6aaef78e2d5">prev</a>; </div>
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno"> 46</span> <a class="code hl_class" href="../../de/d21/classothers_1_1_cache_1_1_d___node.html">D_Node&lt;T&gt;</a> *<a class="code hl_variable" href="../../de/d21/classothers_1_1_cache_1_1_d___node.html#a0043eb287c54b3b2fb91ce354878a7bd">next</a>; </div>
<div class="line"><a id="l00047" name="l00047"></a><span class="lineno"> 47</span> </div>
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno"> 48</span> <span class="keyword">explicit</span> <a class="code hl_class" href="../../de/d21/classothers_1_1_cache_1_1_d___node.html">D_Node</a>(T <a class="code hl_variable" href="../../de/d21/classothers_1_1_cache_1_1_d___node.html#a8902e7ff872fa3c80fe6ce5f5cf5cc75">data</a>) : <a class="code hl_variable" href="../../de/d21/classothers_1_1_cache_1_1_d___node.html#a8902e7ff872fa3c80fe6ce5f5cf5cc75">data</a>(<a class="code hl_variable" href="../../de/d21/classothers_1_1_cache_1_1_d___node.html#a8902e7ff872fa3c80fe6ce5f5cf5cc75">data</a>), <a class="code hl_variable" href="../../de/d21/classothers_1_1_cache_1_1_d___node.html#a19e954cbb710ea8318bcb6aaef78e2d5">prev</a>(<span class="keyword">nullptr</span>), <a class="code hl_variable" href="../../de/d21/classothers_1_1_cache_1_1_d___node.html#a0043eb287c54b3b2fb91ce354878a7bd">next</a>(<span class="keyword">nullptr</span>) {}</div>
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno"> 49</span>};</div>
</div>
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno"> 50</span> </div>
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno"> 51</span><span class="keyword">template</span> &lt;<span class="keyword">typename</span> K, <span class="keyword">typename</span> V&gt;</div>
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno"> 52</span><span class="keyword">using </span><a class="code hl_class" href="../../de/d21/classothers_1_1_cache_1_1_d___node.html">CacheNode</a> = <a class="code hl_class" href="../../de/d21/classothers_1_1_cache_1_1_d___node.html">D_Node&lt;std::pair&lt;K, V&gt;</a>&gt;;</div>
<div class="line"><a id="l00053" name="l00053"></a><span class="lineno"> 53</span> </div>
<div class="line"><a id="l00060" name="l00060"></a><span class="lineno"> 60</span><span class="keyword">template</span> &lt;<span class="keyword">typename</span> K, <span class="keyword">typename</span> V&gt;</div>
<div class="foldopen" id="foldopen00061" data-start="{" data-end="};">
<div class="line"><a id="l00061" name="l00061"></a><span class="lineno"><a class="line" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html"> 61</a></span><span class="keyword">class </span><a class="code hl_class" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html">LRUCache</a> {</div>
<div class="line"><a id="l00062" name="l00062"></a><span class="lineno"><a class="line" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a042bb403f4452ad8c669fbf87ef82821"> 62</a></span> <a class="code hl_class" href="../../de/d21/classothers_1_1_cache_1_1_d___node.html">CacheNode&lt;K, V&gt;</a> *<a class="code hl_variable" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a042bb403f4452ad8c669fbf87ef82821">head</a>; </div>
<div class="line"><a id="l00063" name="l00063"></a><span class="lineno"><a class="line" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a448121f391a71f4cf88c3cb6c4cf3100"> 63</a></span> <a class="code hl_class" href="../../de/d21/classothers_1_1_cache_1_1_d___node.html">CacheNode&lt;K, V&gt;</a> *<a class="code hl_variable" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a448121f391a71f4cf88c3cb6c4cf3100">tail</a>; </div>
<div class="line"><a id="l00064" name="l00064"></a><span class="lineno"><a class="line" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#af34bb8b8eaa34cc499b4fed30b9d05fc"> 64</a></span> std::uint32_t <a class="code hl_variable" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#af34bb8b8eaa34cc499b4fed30b9d05fc">_capacity</a>; </div>
<div class="line"><a id="l00065" name="l00065"></a><span class="lineno"> 65</span> </div>
<div class="line"><a id="l00066" name="l00066"></a><span class="lineno"> 66</span> std::unordered_map&lt;K, CacheNode&lt;K, V&gt; *&gt;</div>
<div class="line"><a id="l00067" name="l00067"></a><span class="lineno"><a class="line" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a8dab0f69410484f772946befd24cc3c5"> 67</a></span> <a class="code hl_variable" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a8dab0f69410484f772946befd24cc3c5">node_map</a>; </div>
<div class="line"><a id="l00068" name="l00068"></a><span class="lineno"> 68</span> </div>
<div class="line"><a id="l00069" name="l00069"></a><span class="lineno"> 69</span> <span class="keyword">public</span>:</div>
<div class="foldopen" id="foldopen00075" data-start="{" data-end="}">
<div class="line"><a id="l00075" name="l00075"></a><span class="lineno"><a class="line" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a8980cbbc9cf0a98a9592b40c4d6ec28f"> 75</a></span> <span class="keyword">explicit</span> <a class="code hl_function" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a8980cbbc9cf0a98a9592b40c4d6ec28f">LRUCache</a>(<span class="keywordtype">int</span> <a class="code hl_variable" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#af34bb8b8eaa34cc499b4fed30b9d05fc">_capacity</a>)</div>
<div class="line"><a id="l00076" name="l00076"></a><span class="lineno"> 76</span> : <a class="code hl_variable" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a042bb403f4452ad8c669fbf87ef82821">head</a>(nullptr), <a class="code hl_variable" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a448121f391a71f4cf88c3cb6c4cf3100">tail</a>(nullptr), <a class="code hl_variable" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#af34bb8b8eaa34cc499b4fed30b9d05fc">_capacity</a>(<a class="code hl_variable" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#af34bb8b8eaa34cc499b4fed30b9d05fc">_capacity</a>) {}</div>
</div>
<div class="line"><a id="l00077" name="l00077"></a><span class="lineno"> 77</span> </div>
<div class="line"><a id="l00078" name="l00078"></a><span class="lineno"> 78</span> <span class="keyword">private</span>:</div>
<div class="foldopen" id="foldopen00083" data-start="{" data-end="}">
<div class="line"><a id="l00083" name="l00083"></a><span class="lineno"><a class="line" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a2e53b5ad1368d87da501f61473eb9ea2"> 83</a></span> <span class="keywordtype">void</span> <a class="code hl_function" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a2e53b5ad1368d87da501f61473eb9ea2">push_front</a>(<a class="code hl_class" href="../../de/d21/classothers_1_1_cache_1_1_d___node.html">CacheNode&lt;K, V&gt;</a> *node_ptr) {</div>
<div class="line"><a id="l00084" name="l00084"></a><span class="lineno"> 84</span> <span class="keywordflow">if</span> (!<a class="code hl_variable" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a042bb403f4452ad8c669fbf87ef82821">head</a>) {</div>
<div class="line"><a id="l00085" name="l00085"></a><span class="lineno"> 85</span> <a class="code hl_variable" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a042bb403f4452ad8c669fbf87ef82821">head</a> = node_ptr;</div>
<div class="line"><a id="l00086" name="l00086"></a><span class="lineno"> 86</span> <a class="code hl_variable" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a448121f391a71f4cf88c3cb6c4cf3100">tail</a> = node_ptr;</div>
<div class="line"><a id="l00087" name="l00087"></a><span class="lineno"> 87</span> <span class="keywordflow">return</span>;</div>
<div class="line"><a id="l00088" name="l00088"></a><span class="lineno"> 88</span> }</div>
<div class="line"><a id="l00089" name="l00089"></a><span class="lineno"> 89</span> </div>
<div class="line"><a id="l00090" name="l00090"></a><span class="lineno"> 90</span> node_ptr-&gt;<a class="code hl_variable" href="../../de/d21/classothers_1_1_cache_1_1_d___node.html#a0043eb287c54b3b2fb91ce354878a7bd">next</a> = <a class="code hl_variable" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a042bb403f4452ad8c669fbf87ef82821">head</a>;</div>
<div class="line"><a id="l00091" name="l00091"></a><span class="lineno"> 91</span> <a class="code hl_variable" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a042bb403f4452ad8c669fbf87ef82821">head</a>-&gt;prev = node_ptr;</div>
<div class="line"><a id="l00092" name="l00092"></a><span class="lineno"> 92</span> <a class="code hl_variable" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a042bb403f4452ad8c669fbf87ef82821">head</a> = node_ptr;</div>
<div class="line"><a id="l00093" name="l00093"></a><span class="lineno"> 93</span> }</div>
</div>
<div class="line"><a id="l00094" name="l00094"></a><span class="lineno"> 94</span> </div>
<div class="foldopen" id="foldopen00099" data-start="{" data-end="}">
<div class="line"><a id="l00099" name="l00099"></a><span class="lineno"><a class="line" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#ad022d494b40f82417340b113445e79a4"> 99</a></span> <span class="keywordtype">void</span> <a class="code hl_function" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#ad022d494b40f82417340b113445e79a4">make_recent</a>(<a class="code hl_class" href="../../de/d21/classothers_1_1_cache_1_1_d___node.html">CacheNode&lt;K, V&gt;</a> *node_ptr) {</div>
<div class="line"><a id="l00100" name="l00100"></a><span class="lineno"> 100</span> <span class="keywordflow">if</span> (<a class="code hl_variable" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a042bb403f4452ad8c669fbf87ef82821">head</a> == node_ptr) {</div>
<div class="line"><a id="l00101" name="l00101"></a><span class="lineno"> 101</span> <span class="keywordflow">return</span>;</div>
<div class="line"><a id="l00102" name="l00102"></a><span class="lineno"> 102</span> }</div>
<div class="line"><a id="l00103" name="l00103"></a><span class="lineno"> 103</span> </div>
<div class="line"><a id="l00104" name="l00104"></a><span class="lineno"> 104</span> <a class="code hl_class" href="../../de/d21/classothers_1_1_cache_1_1_d___node.html">CacheNode&lt;K, V&gt;</a> *prev = node_ptr-&gt;<a class="code hl_variable" href="../../de/d21/classothers_1_1_cache_1_1_d___node.html#a19e954cbb710ea8318bcb6aaef78e2d5">prev</a>;</div>
<div class="line"><a id="l00105" name="l00105"></a><span class="lineno"> 105</span> <a class="code hl_class" href="../../de/d21/classothers_1_1_cache_1_1_d___node.html">CacheNode&lt;K, V&gt;</a> *next = node_ptr-&gt;<a class="code hl_variable" href="../../de/d21/classothers_1_1_cache_1_1_d___node.html#a0043eb287c54b3b2fb91ce354878a7bd">next</a>;</div>
<div class="line"><a id="l00106" name="l00106"></a><span class="lineno"> 106</span> </div>
<div class="line"><a id="l00107" name="l00107"></a><span class="lineno"> 107</span> prev-&gt;<a class="code hl_variable" href="../../de/d21/classothers_1_1_cache_1_1_d___node.html#a0043eb287c54b3b2fb91ce354878a7bd">next</a> = next;</div>
<div class="line"><a id="l00108" name="l00108"></a><span class="lineno"> 108</span> <span class="keywordflow">if</span> (next) {</div>
<div class="line"><a id="l00109" name="l00109"></a><span class="lineno"> 109</span> next-&gt;<a class="code hl_variable" href="../../de/d21/classothers_1_1_cache_1_1_d___node.html#a19e954cbb710ea8318bcb6aaef78e2d5">prev</a> = prev;</div>
<div class="line"><a id="l00110" name="l00110"></a><span class="lineno"> 110</span> } <span class="keywordflow">else</span> {</div>
<div class="line"><a id="l00111" name="l00111"></a><span class="lineno"> 111</span> <a class="code hl_variable" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a448121f391a71f4cf88c3cb6c4cf3100">tail</a> = prev;</div>
<div class="line"><a id="l00112" name="l00112"></a><span class="lineno"> 112</span> }</div>
<div class="line"><a id="l00113" name="l00113"></a><span class="lineno"> 113</span> </div>
<div class="line"><a id="l00114" name="l00114"></a><span class="lineno"> 114</span> node_ptr-&gt;<a class="code hl_variable" href="../../de/d21/classothers_1_1_cache_1_1_d___node.html#a19e954cbb710ea8318bcb6aaef78e2d5">prev</a> = <span class="keyword">nullptr</span>;</div>
<div class="line"><a id="l00115" name="l00115"></a><span class="lineno"> 115</span> node_ptr-&gt;<a class="code hl_variable" href="../../de/d21/classothers_1_1_cache_1_1_d___node.html#a0043eb287c54b3b2fb91ce354878a7bd">next</a> = <span class="keyword">nullptr</span>;</div>
<div class="line"><a id="l00116" name="l00116"></a><span class="lineno"> 116</span> <a class="code hl_function" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a2e53b5ad1368d87da501f61473eb9ea2">push_front</a>(node_ptr);</div>
<div class="line"><a id="l00117" name="l00117"></a><span class="lineno"> 117</span> }</div>
</div>
<div class="line"><a id="l00118" name="l00118"></a><span class="lineno"> 118</span> </div>
<div class="foldopen" id="foldopen00122" data-start="{" data-end="}">
<div class="line"><a id="l00122" name="l00122"></a><span class="lineno"><a class="line" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#ab211a4be58491bf11834cae88a0c44f7"> 122</a></span> <span class="keywordtype">void</span> <a class="code hl_function" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#ab211a4be58491bf11834cae88a0c44f7">pop_back</a>() {</div>
<div class="line"><a id="l00123" name="l00123"></a><span class="lineno"> 123</span> <span class="keywordflow">if</span> (!<a class="code hl_variable" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a042bb403f4452ad8c669fbf87ef82821">head</a>) {</div>
<div class="line"><a id="l00124" name="l00124"></a><span class="lineno"> 124</span> <span class="keywordflow">return</span>;</div>
<div class="line"><a id="l00125" name="l00125"></a><span class="lineno"> 125</span> }</div>
<div class="line"><a id="l00126" name="l00126"></a><span class="lineno"> 126</span> <span class="keywordflow">if</span> (<a class="code hl_variable" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a042bb403f4452ad8c669fbf87ef82821">head</a> == <a class="code hl_variable" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a448121f391a71f4cf88c3cb6c4cf3100">tail</a>) {</div>
<div class="line"><a id="l00127" name="l00127"></a><span class="lineno"> 127</span> <span class="keyword">delete</span> <a class="code hl_variable" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a042bb403f4452ad8c669fbf87ef82821">head</a>;</div>
<div class="line"><a id="l00128" name="l00128"></a><span class="lineno"> 128</span> <a class="code hl_variable" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a042bb403f4452ad8c669fbf87ef82821">head</a> = <span class="keyword">nullptr</span>;</div>
<div class="line"><a id="l00129" name="l00129"></a><span class="lineno"> 129</span> <a class="code hl_variable" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a448121f391a71f4cf88c3cb6c4cf3100">tail</a> = <span class="keyword">nullptr</span>;</div>
<div class="line"><a id="l00130" name="l00130"></a><span class="lineno"> 130</span> <span class="keywordflow">return</span>;</div>
<div class="line"><a id="l00131" name="l00131"></a><span class="lineno"> 131</span> }</div>
<div class="line"><a id="l00132" name="l00132"></a><span class="lineno"> 132</span> </div>
<div class="line"><a id="l00133" name="l00133"></a><span class="lineno"> 133</span> <a class="code hl_class" href="../../de/d21/classothers_1_1_cache_1_1_d___node.html">CacheNode&lt;K, V&gt;</a> *temp = <a class="code hl_variable" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a448121f391a71f4cf88c3cb6c4cf3100">tail</a>;</div>
<div class="line"><a id="l00134" name="l00134"></a><span class="lineno"> 134</span> <a class="code hl_variable" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a448121f391a71f4cf88c3cb6c4cf3100">tail</a> = <a class="code hl_variable" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a448121f391a71f4cf88c3cb6c4cf3100">tail</a>-&gt;<a class="code hl_variable" href="../../de/d21/classothers_1_1_cache_1_1_d___node.html#a19e954cbb710ea8318bcb6aaef78e2d5">prev</a>;</div>
<div class="line"><a id="l00135" name="l00135"></a><span class="lineno"> 135</span> <a class="code hl_variable" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a448121f391a71f4cf88c3cb6c4cf3100">tail</a>-&gt;next = <span class="keyword">nullptr</span>;</div>
<div class="line"><a id="l00136" name="l00136"></a><span class="lineno"> 136</span> <span class="keyword">delete</span> temp;</div>
<div class="line"><a id="l00137" name="l00137"></a><span class="lineno"> 137</span> }</div>
</div>
<div class="line"><a id="l00138" name="l00138"></a><span class="lineno"> 138</span> </div>
<div class="line"><a id="l00139" name="l00139"></a><span class="lineno"> 139</span> <span class="keyword">public</span>:</div>
<div class="foldopen" id="foldopen00145" data-start="{" data-end="}">
<div class="line"><a id="l00145" name="l00145"></a><span class="lineno"><a class="line" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a5ee34fcee480f21bb6f68a34f0f69b45"> 145</a></span> <span class="keywordtype">void</span> <a class="code hl_function" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a5ee34fcee480f21bb6f68a34f0f69b45">put</a>(K key, V value) {</div>
<div class="line"><a id="l00146" name="l00146"></a><span class="lineno"> 146</span> <span class="comment">// update the value if key already exists</span></div>
<div class="line"><a id="l00147" name="l00147"></a><span class="lineno"> 147</span> <span class="keywordflow">if</span> (<a class="code hl_variable" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a8dab0f69410484f772946befd24cc3c5">node_map</a>.count(key)) {</div>
<div class="line"><a id="l00148" name="l00148"></a><span class="lineno"> 148</span> <a class="code hl_variable" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a8dab0f69410484f772946befd24cc3c5">node_map</a>[key]-&gt;data.second = value;</div>
<div class="line"><a id="l00149" name="l00149"></a><span class="lineno"> 149</span> <a class="code hl_function" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#ad022d494b40f82417340b113445e79a4">make_recent</a>(<a class="code hl_variable" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a8dab0f69410484f772946befd24cc3c5">node_map</a>[key]);</div>
<div class="line"><a id="l00150" name="l00150"></a><span class="lineno"> 150</span> <span class="keywordflow">return</span>;</div>
<div class="line"><a id="l00151" name="l00151"></a><span class="lineno"> 151</span> }</div>
<div class="line"><a id="l00152" name="l00152"></a><span class="lineno"> 152</span> </div>
<div class="line"><a id="l00153" name="l00153"></a><span class="lineno"> 153</span> <span class="comment">// if the cache is full</span></div>
<div class="line"><a id="l00154" name="l00154"></a><span class="lineno"> 154</span> <span class="comment">// remove the least recently used item</span></div>
<div class="line"><a id="l00155" name="l00155"></a><span class="lineno"> 155</span> <span class="keywordflow">if</span> (<a class="code hl_variable" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a8dab0f69410484f772946befd24cc3c5">node_map</a>.size() == <a class="code hl_variable" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#af34bb8b8eaa34cc499b4fed30b9d05fc">_capacity</a>) {</div>
<div class="line"><a id="l00156" name="l00156"></a><span class="lineno"> 156</span> <a class="code hl_variable" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a8dab0f69410484f772946befd24cc3c5">node_map</a>.erase(<a class="code hl_variable" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a448121f391a71f4cf88c3cb6c4cf3100">tail</a>-&gt;data.first);</div>
<div class="line"><a id="l00157" name="l00157"></a><span class="lineno"> 157</span> <a class="code hl_function" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#ab211a4be58491bf11834cae88a0c44f7">pop_back</a>();</div>
<div class="line"><a id="l00158" name="l00158"></a><span class="lineno"> 158</span> }</div>
<div class="line"><a id="l00159" name="l00159"></a><span class="lineno"> 159</span> </div>
<div class="line"><a id="l00160" name="l00160"></a><span class="lineno"> 160</span> <a class="code hl_class" href="../../de/d21/classothers_1_1_cache_1_1_d___node.html">CacheNode&lt;K, V&gt;</a> *newNode = <span class="keyword">new</span> <a class="code hl_class" href="../../de/d21/classothers_1_1_cache_1_1_d___node.html">CacheNode&lt;K, V&gt;</a>({key, value});</div>
<div class="line"><a id="l00161" name="l00161"></a><span class="lineno"> 161</span> </div>
<div class="line"><a id="l00162" name="l00162"></a><span class="lineno"> 162</span> <a class="code hl_variable" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a8dab0f69410484f772946befd24cc3c5">node_map</a>[key] = newNode;</div>
<div class="line"><a id="l00163" name="l00163"></a><span class="lineno"> 163</span> <a class="code hl_function" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a2e53b5ad1368d87da501f61473eb9ea2">push_front</a>(newNode);</div>
<div class="line"><a id="l00164" name="l00164"></a><span class="lineno"> 164</span> }</div>
</div>
<div class="line"><a id="l00165" name="l00165"></a><span class="lineno"> 165</span> </div>
<div class="foldopen" id="foldopen00172" data-start="{" data-end="}">
<div class="line"><a id="l00172" name="l00172"></a><span class="lineno"><a class="line" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#ac1be0357ecc7c34144f3d9a63c6cb3ea"> 172</a></span> V <a class="code hl_function" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#ac1be0357ecc7c34144f3d9a63c6cb3ea">get</a>(K key) {</div>
<div class="line"><a id="l00173" name="l00173"></a><span class="lineno"> 173</span> <span class="keywordflow">if</span> (!<a class="code hl_variable" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a8dab0f69410484f772946befd24cc3c5">node_map</a>.count(key)) {</div>
<div class="line"><a id="l00174" name="l00174"></a><span class="lineno"> 174</span> <span class="keywordflow">throw</span> std::runtime_error(<span class="stringliteral">&quot;key is not present in the cache&quot;</span>);</div>
<div class="line"><a id="l00175" name="l00175"></a><span class="lineno"> 175</span> }</div>
<div class="line"><a id="l00176" name="l00176"></a><span class="lineno"> 176</span> </div>
<div class="line"><a id="l00177" name="l00177"></a><span class="lineno"> 177</span> <span class="comment">// move node to the beginning of the list</span></div>
<div class="line"><a id="l00178" name="l00178"></a><span class="lineno"> 178</span> V value = <a class="code hl_variable" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a8dab0f69410484f772946befd24cc3c5">node_map</a>[key]-&gt;data.second;</div>
<div class="line"><a id="l00179" name="l00179"></a><span class="lineno"> 179</span> <a class="code hl_function" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#ad022d494b40f82417340b113445e79a4">make_recent</a>(<a class="code hl_variable" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a8dab0f69410484f772946befd24cc3c5">node_map</a>[key]);</div>
<div class="line"><a id="l00180" name="l00180"></a><span class="lineno"> 180</span> <span class="keywordflow">return</span> value;</div>
<div class="line"><a id="l00181" name="l00181"></a><span class="lineno"> 181</span> }</div>
</div>
<div class="line"><a id="l00182" name="l00182"></a><span class="lineno"> 182</span> </div>
<div class="line"><a id="l00187" name="l00187"></a><span class="lineno"><a class="line" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a1b709333874b4633ee02a3661cd042e1"> 187</a></span> <span class="keywordtype">int</span> <a class="code hl_function" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a1b709333874b4633ee02a3661cd042e1">size</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code hl_variable" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a8dab0f69410484f772946befd24cc3c5">node_map</a>.size(); }</div>
<div class="line"><a id="l00188" name="l00188"></a><span class="lineno"> 188</span> </div>
<div class="line"><a id="l00193" name="l00193"></a><span class="lineno"><a class="line" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#af8edfe5a7def5d5b846463041c33136a"> 193</a></span> <span class="keywordtype">int</span> <a class="code hl_function" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#af8edfe5a7def5d5b846463041c33136a">capacity</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code hl_variable" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#af34bb8b8eaa34cc499b4fed30b9d05fc">_capacity</a>; }</div>
<div class="line"><a id="l00194" name="l00194"></a><span class="lineno"> 194</span> </div>
<div class="line"><a id="l00199" name="l00199"></a><span class="lineno"><a class="line" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#ab8b6a6aa95db678596bc2a49e864683e"> 199</a></span> <span class="keywordtype">bool</span> <a class="code hl_function" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#ab8b6a6aa95db678596bc2a49e864683e">empty</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code hl_variable" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a8dab0f69410484f772946befd24cc3c5">node_map</a>.empty(); }</div>
<div class="line"><a id="l00200" name="l00200"></a><span class="lineno"> 200</span> </div>
<div class="foldopen" id="foldopen00205" data-start="{" data-end="}">
<div class="line"><a id="l00205" name="l00205"></a><span class="lineno"><a class="line" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a6d855ff72ad6fe548eb564b7f87abe06"> 205</a></span> <a class="code hl_function" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a6d855ff72ad6fe548eb564b7f87abe06">~LRUCache</a>() {</div>
<div class="line"><a id="l00206" name="l00206"></a><span class="lineno"> 206</span> <span class="keyword">auto</span> it = <a class="code hl_variable" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a8dab0f69410484f772946befd24cc3c5">node_map</a>.begin();</div>
<div class="line"><a id="l00207" name="l00207"></a><span class="lineno"> 207</span> <span class="keywordflow">while</span> (it != <a class="code hl_variable" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a8dab0f69410484f772946befd24cc3c5">node_map</a>.end()) {</div>
<div class="line"><a id="l00208" name="l00208"></a><span class="lineno"> 208</span> <span class="keyword">delete</span> it-&gt;second;</div>
<div class="line"><a id="l00209" name="l00209"></a><span class="lineno"> 209</span> ++it;</div>
<div class="line"><a id="l00210" name="l00210"></a><span class="lineno"> 210</span> }</div>
<div class="line"><a id="l00211" name="l00211"></a><span class="lineno"> 211</span> }</div>
</div>
<div class="line"><a id="l00212" name="l00212"></a><span class="lineno"> 212</span>};</div>
</div>
<div class="line"><a id="l00213" name="l00213"></a><span class="lineno"> 213</span>} <span class="comment">// namespace Cache</span></div>
<div class="line"><a id="l00214" name="l00214"></a><span class="lineno"> 214</span>} <span class="comment">// namespace others</span></div>
<div class="line"><a id="l00215" name="l00215"></a><span class="lineno"> 215</span> </div>
<div class="foldopen" id="foldopen00220" data-start="{" data-end="}">
<div class="line"><a id="l00220" name="l00220"></a><span class="lineno"><a class="line" href="../../dc/daa/lru__cache2_8cpp.html#aa8dca7b867074164d5f45b0f3851269d"> 220</a></span><span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code hl_function" href="../../dc/daa/lru__cache2_8cpp.html#aa8dca7b867074164d5f45b0f3851269d">test</a>() {</div>
<div class="line"><a id="l00221" name="l00221"></a><span class="lineno"> 221</span> <a class="code hl_class" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html">others::Cache::LRUCache&lt;int, int&gt;</a> cache(5);</div>
<div class="line"><a id="l00222" name="l00222"></a><span class="lineno"> 222</span> </div>
<div class="line"><a id="l00223" name="l00223"></a><span class="lineno"> 223</span> <span class="comment">// test the initial state of the cache</span></div>
<div class="line"><a id="l00224" name="l00224"></a><span class="lineno"> 224</span> assert(cache.<a class="code hl_function" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a1b709333874b4633ee02a3661cd042e1">size</a>() == 0);</div>
<div class="line"><a id="l00225" name="l00225"></a><span class="lineno"> 225</span> assert(cache.<a class="code hl_function" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#af8edfe5a7def5d5b846463041c33136a">capacity</a>() == 5);</div>
<div class="line"><a id="l00226" name="l00226"></a><span class="lineno"> 226</span> assert(cache.<a class="code hl_function" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#ab8b6a6aa95db678596bc2a49e864683e">empty</a>());</div>
<div class="line"><a id="l00227" name="l00227"></a><span class="lineno"> 227</span> </div>
<div class="line"><a id="l00228" name="l00228"></a><span class="lineno"> 228</span> <span class="comment">// test insertion in the cache</span></div>
<div class="line"><a id="l00229" name="l00229"></a><span class="lineno"> 229</span> cache.<a class="code hl_function" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a5ee34fcee480f21bb6f68a34f0f69b45">put</a>(1, 10);</div>
<div class="line"><a id="l00230" name="l00230"></a><span class="lineno"> 230</span> cache.<a class="code hl_function" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a5ee34fcee480f21bb6f68a34f0f69b45">put</a>(-2, 20);</div>
<div class="line"><a id="l00231" name="l00231"></a><span class="lineno"> 231</span> </div>
<div class="line"><a id="l00232" name="l00232"></a><span class="lineno"> 232</span> <span class="comment">// test the state of cache after inserting some items</span></div>
<div class="line"><a id="l00233" name="l00233"></a><span class="lineno"> 233</span> assert(cache.<a class="code hl_function" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a1b709333874b4633ee02a3661cd042e1">size</a>() == 2);</div>
<div class="line"><a id="l00234" name="l00234"></a><span class="lineno"> 234</span> assert(cache.<a class="code hl_function" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#af8edfe5a7def5d5b846463041c33136a">capacity</a>() == 5);</div>
<div class="line"><a id="l00235" name="l00235"></a><span class="lineno"> 235</span> assert(!cache.<a class="code hl_function" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#ab8b6a6aa95db678596bc2a49e864683e">empty</a>());</div>
<div class="line"><a id="l00236" name="l00236"></a><span class="lineno"> 236</span> </div>
<div class="line"><a id="l00237" name="l00237"></a><span class="lineno"> 237</span> <span class="comment">// test getting items from the cache</span></div>
<div class="line"><a id="l00238" name="l00238"></a><span class="lineno"> 238</span> assert(cache.<a class="code hl_function" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#ac1be0357ecc7c34144f3d9a63c6cb3ea">get</a>(1) == 10);</div>
<div class="line"><a id="l00239" name="l00239"></a><span class="lineno"> 239</span> assert(cache.<a class="code hl_function" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#ac1be0357ecc7c34144f3d9a63c6cb3ea">get</a>(-2) == 20);</div>
<div class="line"><a id="l00240" name="l00240"></a><span class="lineno"> 240</span> </div>
<div class="line"><a id="l00241" name="l00241"></a><span class="lineno"> 241</span> cache.<a class="code hl_function" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a5ee34fcee480f21bb6f68a34f0f69b45">put</a>(-3, -30);</div>
<div class="line"><a id="l00242" name="l00242"></a><span class="lineno"> 242</span> cache.<a class="code hl_function" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a5ee34fcee480f21bb6f68a34f0f69b45">put</a>(4, 40);</div>
<div class="line"><a id="l00243" name="l00243"></a><span class="lineno"> 243</span> cache.<a class="code hl_function" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a5ee34fcee480f21bb6f68a34f0f69b45">put</a>(5, -50);</div>
<div class="line"><a id="l00244" name="l00244"></a><span class="lineno"> 244</span> cache.<a class="code hl_function" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a5ee34fcee480f21bb6f68a34f0f69b45">put</a>(6, 60);</div>
<div class="line"><a id="l00245" name="l00245"></a><span class="lineno"> 245</span> </div>
<div class="line"><a id="l00246" name="l00246"></a><span class="lineno"> 246</span> <span class="comment">// test the state after inserting more items than the capacity</span></div>
<div class="line"><a id="l00247" name="l00247"></a><span class="lineno"> 247</span> assert(cache.<a class="code hl_function" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a1b709333874b4633ee02a3661cd042e1">size</a>() == 5);</div>
<div class="line"><a id="l00248" name="l00248"></a><span class="lineno"> 248</span> assert(cache.<a class="code hl_function" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#af8edfe5a7def5d5b846463041c33136a">capacity</a>() == 5);</div>
<div class="line"><a id="l00249" name="l00249"></a><span class="lineno"> 249</span> assert(!cache.<a class="code hl_function" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#ab8b6a6aa95db678596bc2a49e864683e">empty</a>());</div>
<div class="line"><a id="l00250" name="l00250"></a><span class="lineno"> 250</span> </div>
<div class="line"><a id="l00251" name="l00251"></a><span class="lineno"> 251</span> <span class="comment">// fetching 1 throws runtime_error</span></div>
<div class="line"><a id="l00252" name="l00252"></a><span class="lineno"> 252</span> <span class="comment">// as 1 was evicted being the least recently used</span></div>
<div class="line"><a id="l00253" name="l00253"></a><span class="lineno"> 253</span> <span class="comment">// when 6 was added</span></div>
<div class="line"><a id="l00254" name="l00254"></a><span class="lineno"> 254</span> <span class="keywordflow">try</span> {</div>
<div class="line"><a id="l00255" name="l00255"></a><span class="lineno"> 255</span> cache.<a class="code hl_function" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#ac1be0357ecc7c34144f3d9a63c6cb3ea">get</a>(1);</div>
<div class="line"><a id="l00256" name="l00256"></a><span class="lineno"> 256</span> } <span class="keywordflow">catch</span> (<span class="keyword">const</span> std::runtime_error &amp;e) {</div>
<div class="line"><a id="l00257" name="l00257"></a><span class="lineno"> 257</span> assert(std::string(e.what()) == <span class="stringliteral">&quot;key is not present in the cache&quot;</span>);</div>
<div class="line"><a id="l00258" name="l00258"></a><span class="lineno"> 258</span> }</div>
<div class="line"><a id="l00259" name="l00259"></a><span class="lineno"> 259</span> </div>
<div class="line"><a id="l00260" name="l00260"></a><span class="lineno"> 260</span> <span class="comment">// test retrieval of all items in the cache</span></div>
<div class="line"><a id="l00261" name="l00261"></a><span class="lineno"> 261</span> assert(cache.<a class="code hl_function" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#ac1be0357ecc7c34144f3d9a63c6cb3ea">get</a>(-2) == 20);</div>
<div class="line"><a id="l00262" name="l00262"></a><span class="lineno"> 262</span> assert(cache.<a class="code hl_function" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#ac1be0357ecc7c34144f3d9a63c6cb3ea">get</a>(-3) == -30);</div>
<div class="line"><a id="l00263" name="l00263"></a><span class="lineno"> 263</span> assert(cache.<a class="code hl_function" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#ac1be0357ecc7c34144f3d9a63c6cb3ea">get</a>(4) == 40);</div>
<div class="line"><a id="l00264" name="l00264"></a><span class="lineno"> 264</span> assert(cache.<a class="code hl_function" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#ac1be0357ecc7c34144f3d9a63c6cb3ea">get</a>(5) == -50);</div>
<div class="line"><a id="l00265" name="l00265"></a><span class="lineno"> 265</span> assert(cache.<a class="code hl_function" href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#ac1be0357ecc7c34144f3d9a63c6cb3ea">get</a>(6) == 60);</div>
<div class="line"><a id="l00266" name="l00266"></a><span class="lineno"> 266</span> </div>
<div class="line"><a id="l00267" name="l00267"></a><span class="lineno"> 267</span> std::cout &lt;&lt; <span class="stringliteral">&quot;test - passed\n&quot;</span>;</div>
<div class="line"><a id="l00268" name="l00268"></a><span class="lineno"> 268</span>}</div>
</div>
<div class="line"><a id="l00269" name="l00269"></a><span class="lineno"> 269</span> </div>
<div class="foldopen" id="foldopen00274" data-start="{" data-end="}">
<div class="line"><a id="l00274" name="l00274"></a><span class="lineno"><a class="line" href="../../dc/daa/lru__cache2_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4"> 274</a></span><span class="keywordtype">int</span> <a class="code hl_function" href="../../dc/daa/lru__cache2_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4">main</a>() {</div>
<div class="line"><a id="l00275" name="l00275"></a><span class="lineno"> 275</span> <a class="code hl_function" href="../../dc/daa/lru__cache2_8cpp.html#aa8dca7b867074164d5f45b0f3851269d">test</a>(); <span class="comment">// run the self test implementation</span></div>
<div class="line"><a id="l00276" name="l00276"></a><span class="lineno"> 276</span> <span class="keywordflow">return</span> 0;</div>
<div class="line"><a id="l00277" name="l00277"></a><span class="lineno"> 277</span>}</div>
</div>
<div class="ttc" id="aclassothers_1_1_cache_1_1_d___node_html"><div class="ttname"><a href="../../de/d21/classothers_1_1_cache_1_1_d___node.html">others::Cache::D_Node</a></div><div class="ttdoc">Node for a doubly linked list with data, prev and next pointers.</div><div class="ttdef"><b>Definition</b> <a href="#l00042">lru_cache2.cpp:42</a></div></div>
<div class="ttc" id="aclassothers_1_1_cache_1_1_d___node_html_a0043eb287c54b3b2fb91ce354878a7bd"><div class="ttname"><a href="../../de/d21/classothers_1_1_cache_1_1_d___node.html#a0043eb287c54b3b2fb91ce354878a7bd">others::Cache::D_Node::next</a></div><div class="ttdeci">D_Node&lt; T &gt; * next</div><div class="ttdoc">next node in the doubly linked list</div><div class="ttdef"><b>Definition</b> <a href="../../d9/d65/lfu__cache_8cpp_source.html#l00049">lfu_cache.cpp:49</a></div></div>
<div class="ttc" id="aclassothers_1_1_cache_1_1_d___node_html_a19e954cbb710ea8318bcb6aaef78e2d5"><div class="ttname"><a href="../../de/d21/classothers_1_1_cache_1_1_d___node.html#a19e954cbb710ea8318bcb6aaef78e2d5">others::Cache::D_Node::prev</a></div><div class="ttdeci">D_Node&lt; T &gt; * prev</div><div class="ttdoc">previous node in the doubly linked list</div><div class="ttdef"><b>Definition</b> <a href="../../d9/d65/lfu__cache_8cpp_source.html#l00048">lfu_cache.cpp:48</a></div></div>
<div class="ttc" id="aclassothers_1_1_cache_1_1_d___node_html_a8902e7ff872fa3c80fe6ce5f5cf5cc75"><div class="ttname"><a href="../../de/d21/classothers_1_1_cache_1_1_d___node.html#a8902e7ff872fa3c80fe6ce5f5cf5cc75">others::Cache::D_Node::data</a></div><div class="ttdeci">T data</div><div class="ttdoc">data of the node</div><div class="ttdef"><b>Definition</b> <a href="../../d9/d65/lfu__cache_8cpp_source.html#l00047">lfu_cache.cpp:47</a></div></div>
<div class="ttc" id="aclassothers_1_1_cache_1_1_l_r_u_cache_html"><div class="ttname"><a href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html">others::Cache::LRUCache</a></div><div class="ttdoc">LRUCache.</div><div class="ttdef"><b>Definition</b> <a href="#l00061">lru_cache2.cpp:61</a></div></div>
<div class="ttc" id="aclassothers_1_1_cache_1_1_l_r_u_cache_html_a042bb403f4452ad8c669fbf87ef82821"><div class="ttname"><a href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a042bb403f4452ad8c669fbf87ef82821">others::Cache::LRUCache::head</a></div><div class="ttdeci">CacheNode&lt; K, V &gt; * head</div><div class="ttdoc">head of the doubly linked list</div><div class="ttdef"><b>Definition</b> <a href="#l00062">lru_cache2.cpp:62</a></div></div>
<div class="ttc" id="aclassothers_1_1_cache_1_1_l_r_u_cache_html_a1b709333874b4633ee02a3661cd042e1"><div class="ttname"><a href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a1b709333874b4633ee02a3661cd042e1">others::Cache::LRUCache::size</a></div><div class="ttdeci">int size() const</div><div class="ttdoc">Returns the number of items present in the cache.</div><div class="ttdef"><b>Definition</b> <a href="#l00187">lru_cache2.cpp:187</a></div></div>
<div class="ttc" id="aclassothers_1_1_cache_1_1_l_r_u_cache_html_a2e53b5ad1368d87da501f61473eb9ea2"><div class="ttname"><a href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a2e53b5ad1368d87da501f61473eb9ea2">others::Cache::LRUCache::push_front</a></div><div class="ttdeci">void push_front(CacheNode&lt; K, V &gt; *node_ptr)</div><div class="ttdoc">push the node to the front of the linked list.</div><div class="ttdef"><b>Definition</b> <a href="#l00083">lru_cache2.cpp:83</a></div></div>
<div class="ttc" id="aclassothers_1_1_cache_1_1_l_r_u_cache_html_a448121f391a71f4cf88c3cb6c4cf3100"><div class="ttname"><a href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a448121f391a71f4cf88c3cb6c4cf3100">others::Cache::LRUCache::tail</a></div><div class="ttdeci">CacheNode&lt; K, V &gt; * tail</div><div class="ttdoc">tail of the doubly linked list</div><div class="ttdef"><b>Definition</b> <a href="#l00063">lru_cache2.cpp:63</a></div></div>
<div class="ttc" id="aclassothers_1_1_cache_1_1_l_r_u_cache_html_a5ee34fcee480f21bb6f68a34f0f69b45"><div class="ttname"><a href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a5ee34fcee480f21bb6f68a34f0f69b45">others::Cache::LRUCache::put</a></div><div class="ttdeci">void put(K key, V value)</div><div class="ttdoc">upsert a key-value pair</div><div class="ttdef"><b>Definition</b> <a href="#l00145">lru_cache2.cpp:145</a></div></div>
<div class="ttc" id="aclassothers_1_1_cache_1_1_l_r_u_cache_html_a6d855ff72ad6fe548eb564b7f87abe06"><div class="ttname"><a href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a6d855ff72ad6fe548eb564b7f87abe06">others::Cache::LRUCache::~LRUCache</a></div><div class="ttdeci">~LRUCache()</div><div class="ttdoc">destructs the cache, iterates on the map and deletes every node present in the cache.</div><div class="ttdef"><b>Definition</b> <a href="#l00205">lru_cache2.cpp:205</a></div></div>
<div class="ttc" id="aclassothers_1_1_cache_1_1_l_r_u_cache_html_a8980cbbc9cf0a98a9592b40c4d6ec28f"><div class="ttname"><a href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a8980cbbc9cf0a98a9592b40c4d6ec28f">others::Cache::LRUCache::LRUCache</a></div><div class="ttdeci">LRUCache(int _capacity)</div><div class="ttdoc">Constructor, Initialize the head and tail pointers to nullptr and initialize the _capacity of the cac...</div><div class="ttdef"><b>Definition</b> <a href="#l00075">lru_cache2.cpp:75</a></div></div>
<div class="ttc" id="aclassothers_1_1_cache_1_1_l_r_u_cache_html_a8dab0f69410484f772946befd24cc3c5"><div class="ttname"><a href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#a8dab0f69410484f772946befd24cc3c5">others::Cache::LRUCache::node_map</a></div><div class="ttdeci">std::unordered_map&lt; K, CacheNode&lt; K, V &gt; * &gt; node_map</div><div class="ttdoc">maps the key to the node address</div><div class="ttdef"><b>Definition</b> <a href="#l00067">lru_cache2.cpp:67</a></div></div>
<div class="ttc" id="aclassothers_1_1_cache_1_1_l_r_u_cache_html_ab211a4be58491bf11834cae88a0c44f7"><div class="ttname"><a href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#ab211a4be58491bf11834cae88a0c44f7">others::Cache::LRUCache::pop_back</a></div><div class="ttdeci">void pop_back()</div><div class="ttdoc">pop the last node in the linked list.</div><div class="ttdef"><b>Definition</b> <a href="#l00122">lru_cache2.cpp:122</a></div></div>
<div class="ttc" id="aclassothers_1_1_cache_1_1_l_r_u_cache_html_ab8b6a6aa95db678596bc2a49e864683e"><div class="ttname"><a href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#ab8b6a6aa95db678596bc2a49e864683e">others::Cache::LRUCache::empty</a></div><div class="ttdeci">bool empty() const</div><div class="ttdoc">returns whether the cache is empty or not</div><div class="ttdef"><b>Definition</b> <a href="#l00199">lru_cache2.cpp:199</a></div></div>
<div class="ttc" id="aclassothers_1_1_cache_1_1_l_r_u_cache_html_ac1be0357ecc7c34144f3d9a63c6cb3ea"><div class="ttname"><a href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#ac1be0357ecc7c34144f3d9a63c6cb3ea">others::Cache::LRUCache::get</a></div><div class="ttdeci">V get(K key)</div><div class="ttdoc">get the value of the key-value pair if exists</div><div class="ttdef"><b>Definition</b> <a href="#l00172">lru_cache2.cpp:172</a></div></div>
<div class="ttc" id="aclassothers_1_1_cache_1_1_l_r_u_cache_html_ad022d494b40f82417340b113445e79a4"><div class="ttname"><a href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#ad022d494b40f82417340b113445e79a4">others::Cache::LRUCache::make_recent</a></div><div class="ttdeci">void make_recent(CacheNode&lt; K, V &gt; *node_ptr)</div><div class="ttdoc">move the existing node in the list to the beginning of the list.</div><div class="ttdef"><b>Definition</b> <a href="#l00099">lru_cache2.cpp:99</a></div></div>
<div class="ttc" id="aclassothers_1_1_cache_1_1_l_r_u_cache_html_af34bb8b8eaa34cc499b4fed30b9d05fc"><div class="ttname"><a href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#af34bb8b8eaa34cc499b4fed30b9d05fc">others::Cache::LRUCache::_capacity</a></div><div class="ttdeci">std::uint32_t _capacity</div><div class="ttdoc">maximum capacity of the cache</div><div class="ttdef"><b>Definition</b> <a href="#l00064">lru_cache2.cpp:64</a></div></div>
<div class="ttc" id="aclassothers_1_1_cache_1_1_l_r_u_cache_html_af8edfe5a7def5d5b846463041c33136a"><div class="ttname"><a href="../../d8/d2e/classothers_1_1_cache_1_1_l_r_u_cache.html#af8edfe5a7def5d5b846463041c33136a">others::Cache::LRUCache::capacity</a></div><div class="ttdeci">int capacity() const</div><div class="ttdoc">Returns the total capacity of the cache.</div><div class="ttdef"><b>Definition</b> <a href="#l00193">lru_cache2.cpp:193</a></div></div>
<div class="ttc" id="alru__cache2_8cpp_html_aa8dca7b867074164d5f45b0f3851269d"><div class="ttname"><a href="../../dc/daa/lru__cache2_8cpp.html#aa8dca7b867074164d5f45b0f3851269d">test</a></div><div class="ttdeci">static void test()</div><div class="ttdoc">self test implementations</div><div class="ttdef"><b>Definition</b> <a href="#l00220">lru_cache2.cpp:220</a></div></div>
<div class="ttc" id="alru__cache2_8cpp_html_ae66f6b31b5ad750f1fe042a706a4e3d4"><div class="ttname"><a href="../../dc/daa/lru__cache2_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4">main</a></div><div class="ttdeci">int main()</div><div class="ttdoc">main function</div><div class="ttdef"><b>Definition</b> <a href="#l00274">lru_cache2.cpp:274</a></div></div>
<div class="ttc" id="anamespaceothers_html"><div class="ttname"><a href="../../d0/d6f/namespaceothers.html">others</a></div><div class="ttdoc">for vector</div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="../../dir_9510827d0b234b3cc54b29892f217477.html">others</a></li><li class="navelem"><a class="el" href="../../dc/daa/lru__cache2_8cpp.html">lru_cache2.cpp</a></li>
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="../../doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.12.0 </li>
</ul>
</div>
</body>
</html>