mirror of
https://github.com/TheAlgorithms/C-Plus-Plus.git
synced 2026-03-23 21:32:09 +08:00
Documentation for 8b1eab204b
This commit is contained in:
@@ -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"> 1.0.0</span>
|
||||
<div id="projectname">TheAlgorithms/C++<span id="projectnumber"> 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  </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< T ></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">◆ </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<int, int></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> &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">"key is not present in the cache"</span>);</div>
|
||||
<div class="line"><span class="lineno"> 256</span> } <span class="keywordflow">catch</span> (<span class="keyword">const</span> std::runtime_error &e) {</div>
|
||||
<div class="line"><span class="lineno"> 257</span> assert(std::string(e.what()) == <span class="stringliteral">"key is not present in the cache"</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> << <span class="stringliteral">"test - passed\n"</span>;</div>
|
||||
<div class="line"><span class="lineno"> 267</span> std::cout << <span class="stringliteral">"test - passed\n"</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 -->
|
||||
|
||||
Reference in New Issue
Block a user