<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.ds-queue.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'zh',
  ),
  'this' => 
  array (
    0 => 'ds-queue.allocate.php',
    1 => 'Ds\\Queue::allocate',
    2 => 'Allocates enough memory for a required capacity',
  ),
  'up' => 
  array (
    0 => 'class.ds-queue.php',
    1 => 'Ds\\Queue',
  ),
  'prev' => 
  array (
    0 => 'class.ds-queue.php',
    1 => 'Ds\\Queue',
  ),
  'next' => 
  array (
    0 => 'ds-queue.capacity.php',
    1 => 'Ds\\Queue::capacity',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/ds/ds/queue/allocate.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="ds-queue.allocate" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">Ds\Queue::allocate</h1>
  <p class="verinfo">(PECL ds &gt;= 1.0.0)</p><p class="refpurpose"><span class="refname">Ds\Queue::allocate</span> &mdash; <span class="dc-title">Allocates enough memory for a required capacity</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-ds-queue.allocate-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>Ds\Queue::allocate</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$capacity</code></span>): <span class="type"><a href="language.types.void.php" class="type void">void</a></span></div>

  <p class="para rdfs-comment">
    Ensures that enough memory is allocated for a required capacity.
    This removes the need to reallocate the internal as values are added.
  </p>
  <blockquote class="note"><p><strong class="note">注意</strong>: 
    <p class="para">
        Capacity will always be rounded up to the nearest power of 2.
    </p>
  </p></blockquote>
 </div>


 <div class="refsect1 parameters" id="refsect1-ds-queue.allocate-parameters">
  <h3 class="title">参数</h3>
  <dl>
   
    <dt><code class="parameter">capacity</code></dt>
    <dd>
     <p class="para">
        The number of values for which capacity should be allocated.
     </p>
     <blockquote class="note"><p><strong class="note">注意</strong>: 
        <p class="para">
            Capacity will stay the same if this value is less than or equal to the
            current capacity.
        </p>
    </p></blockquote>
    <blockquote class="note"><p><strong class="note">注意</strong>: 
        <p class="para">
            Capacity will always be rounded up to the nearest power of 2.
        </p>
     </p></blockquote>
    </dd>
   
  </dl>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-ds-queue.allocate-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
    没有返回值。
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-ds-queue.allocate-examples">
  <h3 class="title">示例</h3>
  <div class="example" id="example-1">
   <p><strong>示例 #1 <span class="function"><strong>Ds\Queue::allocate()</strong></span> example</strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$queue </span><span style="color: #007700">= new </span><span style="color: #0000BB">\Ds\Queue</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$queue</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">capacity</span><span style="color: #007700">());<br /><br /></span><span style="color: #0000BB">$queue</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">allocate</span><span style="color: #007700">(</span><span style="color: #0000BB">100</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$queue</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">capacity</span><span style="color: #007700">());<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>

   <div class="example-contents"><p>以上示例的输出类似于：</p></div>
   <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">int(8)
int(128)</pre>
</div>
   </div>
  </div>
 </div>



</div><?php manual_footer($setup); ?>