<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <link rel="stylesheet" href="style.css" type="text/css"> <meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type"> <link rel="Start" href="index.html"> <link rel="next" href="Res.BitDefStrat.html"> <link rel="Up" href="Res.html"> <link title="Index of types" rel=Appendix href="index_types.html"> <link title="Index of values" rel=Appendix href="index_values.html"> <link title="Index of modules" rel=Appendix href="index_modules.html"> <link title="Index of module types" rel=Appendix href="index_module_types.html"> <link title="Nopres_impl" rel="Chapter" href="Nopres_impl.html"> <link title="Nopres_intf" rel="Chapter" href="Nopres_intf.html"> <link title="Pres_impl" rel="Chapter" href="Pres_impl.html"> <link title="Pres_intf" rel="Chapter" href="Pres_intf.html"> <link title="Res" rel="Chapter" href="Res.html"> <link title="Strat" rel="Chapter" href="Strat.html"> <link title="Weak_impl" rel="Chapter" href="Weak_impl.html"> <link title="Weak_intf" rel="Chapter" href="Weak_intf.html"><title>Res.DefStrat</title> </head> <body> <div class="navbar"> <a class="up" href="Res.html" title="Res">Up</a> <a class="post" href="Res.BitDefStrat.html" title="Res.BitDefStrat">Next</a> </div> <h1>Module <a href="type_Res.DefStrat.html">Res.DefStrat</a></h1> <pre><span class="keyword">module</span> DefStrat: <code class="type"><a href="Strat.T.html">Strat.T</a></code><code class="type"> with type t = float * float * int</code></pre><div class="info module top"> Default strategy for resizable datastructures <p> <code class="code">type t</code> is a triple <code class="code">waste, shrink_trig, min_size</code>, where <code class="code">waste</code> (default: 1.5) indicates by how much the array should be grown in excess when reallocation is triggered, <code class="code">shrink_trig</code> (default: 0.5) at which percentage of excess elements it should be shrinked and <code class="code">min_size</code> (default: 16 elements) is the minimum size of the resizable array.<br> </div> <hr width="100%"> <pre><span id="TYPEt"><span class="keyword">type</span> <code class="type"></code>t</span> </pre> <div class="info "> The abstract type of strategies.<br> </div> <pre><span id="VALdefault"><span class="keyword">val</span> default</span> : <code class="type"><a href="Strat.T.html#TYPEt">t</a></code></pre><div class="info "> Default strategy of this strategy implementation.<br> </div> <pre><span id="VALgrow"><span class="keyword">val</span> grow</span> : <code class="type"><a href="Strat.T.html#TYPEt">t</a> -> int -> int</code></pre><div class="info "> <code class="code">grow strat new_len</code><br> <b>Returns</b> the new real length of some contiguous datastructure using strategy <code class="code">strat</code> given new virtual length <code class="code">new_len</code>. The user should then use this new real length to resize the datastructure. <p> Be careful, the new (real) length <b>must</b> be larger than the new virtual length, otherwise your program will crash!<br> </div> <pre><span id="VALshrink"><span class="keyword">val</span> shrink</span> : <code class="type"><a href="Strat.T.html#TYPEt">t</a> -> real_len:int -> new_len:int -> int</code></pre><div class="info "> <code class="code">shrink strat ~real_len ~new_len</code><br> <b>Returns</b> the new real length of a resizable datastructure given its current real length <code class="code">real_len</code> and its required new virtual length <code class="code">new_len</code> wrt. strategy <code class="code">strat</code>. The user should then use this new real length to resize the datastructure. If <code class="code">-1</code> is returned, it is not necessary to resize. <p> Be careful, the new (real) length <b>must</b> be larger than the new (virtual) length, otherwise your program may crash!<br> </div> </body></html>